-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove coremltools submodule *security vulnerability* and copy the co…
…reml model schema (#10424) * remove coremltools submodule * update cgmanifest * Copy proto files directly from coremltools
- Loading branch information
1 parent
c4f1dfc
commit 5f0ba31
Showing
35 changed files
with
8,912 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule coremltools
deleted from
523d5e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
onnxruntime/core/providers/coreml/mlmodel_format/ArrayFeatureExtractor.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2017, Apple Inc. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-3-clause license that can be | ||
// found in LICENSE.txt or at https://opensource.org/licenses/BSD-3-Clause | ||
|
||
syntax = "proto3"; | ||
option optimize_for = LITE_RUNTIME; | ||
|
||
package CoreML.Specification; | ||
|
||
/** | ||
* An array feature extractor. | ||
* | ||
* Given an index, extracts the value at that index from its array input. | ||
* Indexes are zero-based. | ||
*/ | ||
message ArrayFeatureExtractor { | ||
repeated uint64 extractIndex = 1; | ||
} |
139 changes: 139 additions & 0 deletions
139
onnxruntime/core/providers/coreml/mlmodel_format/BayesianProbitRegressor.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
// Copyright (c) 2017, Apple Inc. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-3-clause license that can be | ||
// found in LICENSE.txt or at https://opensource.org/licenses/BSD-3-Clause | ||
|
||
syntax = "proto3"; | ||
option optimize_for = LITE_RUNTIME; | ||
|
||
package CoreML.Specification; | ||
|
||
/** | ||
* A Bayesian probit regressor. | ||
* | ||
* The probit regression model is superficially similar to the more commonly known | ||
* logistic regression, with sampling distribution of the model given by | ||
* | ||
* P(y=+1|x,w) = Φ(<w,x>/β) | ||
* | ||
* where w are the set of weights, | ||
* x are the set of features for the given event, | ||
* β is a model hyper-parameter, and | ||
* Φ is the link function, defined to be the CDF of the normal distribution. | ||
* The weights w[i,j] are Gaussian distributed, with mean μ[i,j] and precision 1/(σ[i,j])^2 | ||
* (where i indexes over features and j indexes over the values for the feature). | ||
* The parameter β scales the steepness of the inverse link function. | ||
* | ||
* (see https://en.wikipedia.org/wiki/Probit_model and https://en.wikipedia.org/wiki/Logistic_regression | ||
* for more details on probit model and logistic regression, respectively) | ||
* | ||
* Input: X | ||
* x represents a set of features, each taking on a discrete value (note that continuous values | ||
* would first need to be discretized). x can be represented as a vector where the index i is | ||
* the feature id and x[i] is the feature value. Alternatively, x can be represented as a matrix | ||
* with 2 columns where the first column indicates the feature id and the second column contains | ||
* the feature values, i.e. x[i,0] is the feature id and x[i,1] is the feature value. | ||
* | ||
* additional input features: | ||
* - "optimism": apply a mean shift to the probability, i.e. shift regression mean by o*stdev, | ||
* where o is the "optimism" parameter (see additional output features) | ||
* - "samplingScale": for sampling from posterior, multiply standard deviation by this factor | ||
* - "samplingTruncation": for sampling from posterior, truncate sampling distribution at given multiple of std from mean | ||
* | ||
* Output: Y | ||
* probability P(y|x,w) | ||
* | ||
* additional output features: | ||
* - mean (regression output before applying link function) | ||
* - variance (regression output variance before applying link function) | ||
* - pessimistic probability: P(y|x,w) with a mean shift parameterized by "optimism" feature | ||
* - sampled probability: p ~ P(y|x,w) with standard deviation scaling parametrized by "samplingScale" feature | ||
* and distribution truncated at multiple of standard deviation, | ||
* where multiple parameterized by "samplingTruncation" feature. | ||
* | ||
*/ | ||
|
||
message BayesianProbitRegressor { | ||
|
||
/* | ||
* Parameterization of a Gaussian distribution | ||
*/ | ||
message Gaussian { | ||
double mean = 1; | ||
double precision = 2; // inverse of the variance | ||
} | ||
|
||
/* | ||
* Weight for a specific feature value | ||
* The weight is represented as a Gaussian distribution | ||
* with a mean and precision (1/variance) to capture | ||
* uncertainty in the weight | ||
*/ | ||
message FeatureValueWeight { | ||
uint32 featureValue = 1; | ||
Gaussian featureWeight = 2; | ||
} | ||
|
||
/* | ||
* Feature with associated weights (for different values) | ||
* Each feature has a set of weights for the (discrete) values | ||
* it can take | ||
*/ | ||
message FeatureWeight { | ||
uint32 featureId = 1; | ||
repeated FeatureValueWeight weights = 2; | ||
} | ||
|
||
uint32 numberOfFeatures = 1; | ||
|
||
Gaussian bias = 2; // bias term | ||
|
||
/* | ||
* Set of features with associated weights | ||
*/ | ||
repeated FeatureWeight features = 3; // feature weights | ||
|
||
/* | ||
* Set this name to be the same as input feature of type multi-array (1D) | ||
* in the model description you want to use as the regression input | ||
*/ | ||
string regressionInputFeatureName = 10; | ||
|
||
/* | ||
* Set this name to be the same as optional input feature of type double | ||
* in the model description you want to use as the optimism input | ||
*/ | ||
string optimismInputFeatureName = 11; | ||
|
||
/* | ||
* Set this name to be the same as optional input feature of type double | ||
* in the model description you want to use as the samplingScale input | ||
*/ | ||
string samplingScaleInputFeatureName = 12; | ||
|
||
/* | ||
* Set this name to be the same as optional input feature of type double | ||
* in the model description you want to use as the samplingBounds input | ||
*/ | ||
string samplingTruncationInputFeatureName = 13; | ||
|
||
/* | ||
* name of 'mean' output feature | ||
*/ | ||
string meanOutputFeatureName = 20; | ||
|
||
/* | ||
* name of 'variance' output feature | ||
*/ | ||
string varianceOutputFeatureName = 21; | ||
|
||
/* | ||
* name of 'pessimistic' output feature | ||
*/ | ||
string pessimisticProbabilityOutputFeatureName = 22; | ||
|
||
/* | ||
* name of 'sampled' output feature: samples from the scaled posterior probability distribuiton | ||
*/ | ||
string sampledProbabilityOutputFeatureName = 23; | ||
} |
38 changes: 38 additions & 0 deletions
38
onnxruntime/core/providers/coreml/mlmodel_format/CategoricalMapping.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) 2017, Apple Inc. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-3-clause license that can be | ||
// found in LICENSE.txt or at https://opensource.org/licenses/BSD-3-Clause | ||
|
||
syntax = "proto3"; | ||
option optimize_for = LITE_RUNTIME; | ||
|
||
import public "DataStructures.proto"; | ||
|
||
package CoreML.Specification; | ||
|
||
/** | ||
* A categorical mapping. | ||
* | ||
* This allows conversion from integers to strings, or from strings to integers. | ||
*/ | ||
message CategoricalMapping { | ||
oneof MappingType { | ||
// Conversion from strings to integers | ||
StringToInt64Map stringToInt64Map = 1; | ||
|
||
// Conversion from integer to string | ||
Int64ToStringMap int64ToStringMap = 2; | ||
} | ||
|
||
/** | ||
* The value returned if an input is not contained in the map above. | ||
* If one of these is not set, then an error is raised on an unknown input. | ||
*/ | ||
oneof ValueOnUnknown { | ||
// Default output when converting from an integer to a string. | ||
string strValue = 101; | ||
|
||
// Default output when converting from a string to an integer. | ||
int64 int64Value = 102; | ||
} | ||
} |
Oops, something went wrong.