Skip to content

Commit

Permalink
[coreml-tools] Update to 8.1 (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
luncliff authored Feb 18, 2025
1 parent fc6d0cc commit 81a2874
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 60 deletions.
55 changes: 0 additions & 55 deletions ports/coreml-tools/fix-sources.patch
Original file line number Diff line number Diff line change
@@ -1,58 +1,3 @@
diff --git a/mlmodel/src/Utils.hpp b/mlmodel/src/Utils.hpp
index 9daec54..a95100c 100644
--- a/mlmodel/src/Utils.hpp
+++ b/mlmodel/src/Utils.hpp
@@ -62,7 +62,7 @@ namespace CoreML {
google::protobuf::io::CodedInputStream codedInput(&rawInput);

// Support models up to 2GB
- codedInput.SetTotalBytesLimit(std::numeric_limits<int>::max(), -1);
+ codedInput.SetTotalBytesLimit(std::numeric_limits<int>::max());

if (!formatObj.ParseFromCodedStream(&codedInput)) {
return Result(ResultType::FAILED_TO_DESERIALIZE,
diff --git a/mlmodel/src/Validation/KNearestNeighborsClassifierValidator.cpp b/mlmodel/src/Validation/KNearestNeighborsClassifierValidator.cpp
index fcc6e68..6838a82 100644
--- a/mlmodel/src/Validation/KNearestNeighborsClassifierValidator.cpp
+++ b/mlmodel/src/Validation/KNearestNeighborsClassifierValidator.cpp
@@ -99,7 +99,7 @@ namespace CoreML {
int intLabelCount = knnClassifier.has_int64classlabels() ? knnClassifier.int64classlabels().vector_size() : 0;
int stringLabelCount = knnClassifier.has_stringclasslabels() ? knnClassifier.stringclasslabels().vector_size() : 0;

- int labelCount = MAX(intLabelCount, stringLabelCount);
+ int labelCount = std::max<int>(intLabelCount, stringLabelCount);

auto classLabelCase = knnClassifier.ClassLabels_case();
auto defaultClassLabelIsInt64 = false;
diff --git a/mlmodel/src/Validation/NeuralNetwork/NeuralNetworkLayerValidator.cpp b/mlmodel/src/Validation/NeuralNetwork/NeuralNetworkLayerValidator.cpp
index c09864b..9bac6c2 100644
--- a/mlmodel/src/Validation/NeuralNetwork/NeuralNetworkLayerValidator.cpp
+++ b/mlmodel/src/Validation/NeuralNetwork/NeuralNetworkLayerValidator.cpp
@@ -2851,9 +2851,8 @@ Result NeuralNetworkSpecValidator::validateLayerNormalizationLayer(const Specifi
return Result(ResultType::INVALID_MODEL_PARAMETERS, err);
}
// shape of gamma and beta should match normalized shape
- const int totalShape = std::accumulate(params.normalizedshape().begin(),
- params.normalizedshape().end(),
- 1, std::multiplies<int>());
+ int totalShape = 1;
+ std::for_each(params.normalizedshape().begin(), params.normalizedshape().end(), [&totalShape](int64_t value){ totalShape *= value; });
if (params.gamma().floatvalue_size() != totalShape) {
err = "Shape of gamma should match normalized_shape for '" + layer.name() + "' layer.";
return Result(ResultType::INVALID_MODEL_PARAMETERS, err);
diff --git a/mlmodel/src/Validation/ParameterValidator.cpp b/mlmodel/src/Validation/ParameterValidator.cpp
index 6e8092b..883c880 100644
--- a/mlmodel/src/Validation/ParameterValidator.cpp
+++ b/mlmodel/src/Validation/ParameterValidator.cpp
@@ -66,7 +66,7 @@ Result CoreML::validateInt64Parameter(const std::string& parameterName, const Sp

Result CoreML::validateDoubleParameter(const std::string& parameterName, const Specification::DoubleParameter& doubleParameter) {

- const ::google::protobuf::double_t defaultValue = doubleParameter.defaultvalue();
+ const double defaultValue = doubleParameter.defaultvalue();

if (doubleParameter.has_range()) {
const Specification::DoubleRange& range = doubleParameter.range();
diff --git a/mlmodel/tools/enumgen.cpp b/mlmodel/tools/enumgen.cpp
index f6feb4b..5c07c55 100644
--- a/mlmodel/tools/enumgen.cpp
Expand Down
6 changes: 3 additions & 3 deletions ports/coreml-tools/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO apple/coremltools
REF 8.0
SHA512 ed1c5140d8b613632dcc408b789176ec95c11e3e1a504df92d1f7930e79e6eb9de8a42c18cf19bb115e52d5c4c64ed22e61e6bb1e8d97ebb8291a6c1e8c42920
REF 8.1
SHA512 666f93eb29abdebba93e686486f4cd92f8e9e1a07e835b8e6cb652e6d0ba3ab2bd62d8743e7b121375abcb5f26939c0ac57f0262c28ac3b3aa8c17b75b93fbfd
HEAD_REF master
PATCHES
fix-cmake.patch
Expand Down Expand Up @@ -41,7 +41,7 @@ function(get_python_site_packages PYTHON OUT_PATH)
endfunction()
get_python_site_packages("${PYTHON3}" SITE_PACKAGES_DIR)

message(STATUS "Using python3: ${PYTHON3} ${PYTHON_VERSION}")
message(STATUS "Using python3: ${PYTHON3} '${PYTHON_VERSION}'")
message(STATUS " site-packages: ${SITE_PACKAGES_DIR}")

if(VCPKG_CROSSCOMPILING)
Expand Down
2 changes: 1 addition & 1 deletion ports/coreml-tools/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coreml-tools",
"version": "8.0",
"version": "8.1",
"description": "Core ML tools contain supporting tools for Core ML model conversion, editing, and validation.",
"homepage": "https://coremltools.readme.io/",
"license": "BSD-3-Clause",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"port-version": 0
},
"coreml-tools": {
"baseline": "8.0",
"baseline": "8.1",
"port-version": 0
},
"cpuinfo": {
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/coreml-tools.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "8082d3a130479e412ecc5fed81d2526159c066cf",
"version": "8.1",
"port-version": 0
},
{
"git-tree": "944d53dcd89117fe9ee7484b0e0ae88e36a9b7d5",
"version": "8.0",
Expand Down

0 comments on commit 81a2874

Please sign in to comment.