-
-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow backends to report fixable errors
- Loading branch information
1 parent
e8113d0
commit 47118a0
Showing
1,577 changed files
with
704,641 additions
and
88 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
__packaged__/coreml/.python_dependencies/coremltools-6.3.0.dist-info/INSTALLER
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 @@ | ||
pip |
11 changes: 11 additions & 0 deletions
11
__packaged__/coreml/.python_dependencies/coremltools-6.3.0.dist-info/LICENSE.txt
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,11 @@ | ||
Copyright (c) 2020, Apple Inc. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
60 changes: 60 additions & 0 deletions
60
__packaged__/coreml/.python_dependencies/coremltools-6.3.0.dist-info/METADATA
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,60 @@ | ||
Metadata-Version: 2.1 | ||
Name: coremltools | ||
Version: 6.3.0 | ||
Summary: Community Tools for Core ML | ||
Home-page: https://github.com/apple/coremltools | ||
Author: Apple Inc. | ||
Author-email: [email protected] | ||
License: BSD | ||
Classifier: Development Status :: 5 - Production/Stable | ||
Classifier: Intended Audience :: Developers | ||
Classifier: Operating System :: MacOS :: MacOS X | ||
Classifier: Operating System :: POSIX :: Linux | ||
Classifier: Programming Language :: Python :: 3.7 | ||
Classifier: Programming Language :: Python :: 3.8 | ||
Classifier: Programming Language :: Python :: 3.9 | ||
Classifier: Programming Language :: Python :: 3.10 | ||
Classifier: Topic :: Scientific/Engineering | ||
Classifier: Topic :: Software Development | ||
License-File: LICENSE.txt | ||
Requires-Dist: numpy (>=1.14.5) | ||
Requires-Dist: protobuf (<=4.0.0,>=3.1.0) | ||
Requires-Dist: sympy | ||
Requires-Dist: tqdm | ||
Requires-Dist: packaging | ||
|
||
coremltools | ||
=========== | ||
|
||
`Core ML <http://developer.apple.com/documentation/coreml>`_ | ||
is an Apple framework that allows developers to easily integrate | ||
machine learning (ML) models into apps. Core ML is available on iOS, iPadOS, | ||
watchOS, macOS, and tvOS. Core ML introduces a public file format (.mlmodel) | ||
for a broad set of ML methods including deep neural networks (convolutional | ||
and recurrent), tree ensembles (boosted trees, random forest, decision trees), | ||
and generalized linear models. Core ML models can be directly integrated into | ||
apps within Xcode. | ||
|
||
:code:`coremltools` is a python package for creating, examining, and testing models in | ||
the .mlmodel format. In particular, it can be used to: | ||
|
||
- Convert trained models from popular machine learning tools into Core ML format | ||
(.mlmodel). | ||
- Write models to Core ML format with a simple API. | ||
- Making predictions using the Core ML framework (on select platforms) to | ||
verify conversion. | ||
|
||
More Information | ||
---------------- | ||
|
||
- `coremltools user guide and examples <https://coremltools.readme.io/>`_ | ||
- `Core ML framework documentation <http://developer.apple.com/documentation/coreml>`_ | ||
- `Machine learning at Apple <https://developer.apple.com/machine-learning>`_ | ||
|
||
License | ||
------- | ||
Copyright (c) 2020, Apple Inc. All rights reserved. | ||
|
||
Use of this source code is governed by the | ||
`3-Clause BSD License <https://opensource.org/licenses/BSD-3-Clause>`_ | ||
that can be found in the LICENSE.txt file. |
801 changes: 801 additions & 0 deletions
801
__packaged__/coreml/.python_dependencies/coremltools-6.3.0.dist-info/RECORD
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
5 changes: 5 additions & 0 deletions
5
__packaged__/coreml/.python_dependencies/coremltools-6.3.0.dist-info/WHEEL
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,5 @@ | ||
Wheel-Version: 1.0 | ||
Generator: bdist_wheel (0.38.4) | ||
Root-Is-Purelib: true | ||
Tag: cp310-none-macosx_11_0_arm64 | ||
|
1 change: 1 addition & 0 deletions
1
__packaged__/coreml/.python_dependencies/coremltools-6.3.0.dist-info/top_level.txt
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 @@ | ||
coremltools |
114 changes: 114 additions & 0 deletions
114
__packaged__/coreml/.python_dependencies/coremltools/__init__.py
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,114 @@ | ||
# 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 the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause | ||
|
||
""" | ||
Core ML is an Apple framework which allows developers to simply and easily integrate machine | ||
learning (ML) models into apps running on Apple devices (including iOS, watchOS, macOS, and | ||
tvOS). Core ML introduces a public file format (.mlmodel) for a broad set of ML methods | ||
including deep neural networks (both convolutional and recurrent), tree ensembles with boosting, | ||
and generalized linear models. Models in this format can be directly integrated into apps | ||
through Xcode. | ||
Coremltools is a python package for creating, examining, and testing models in the .mlpackage | ||
and .mlmodel formats. In particular, it can be used to: | ||
* Convert existing models to .mlpackage or .mlmodel formats from popular machine learning tools including: | ||
PyTorch, TensorFlow, scikit-learn, XGBoost and libsvm. | ||
* Express models in .mlpackage and .mlmodel formats through a simple API. | ||
* Make predictions with .mlpackage and .mlmodel files (on macOS). | ||
For more information: http://developer.apple.com/documentation/coreml | ||
""" | ||
from enum import Enum as _Enum | ||
from logging import getLogger as _getLogger | ||
|
||
from .version import __version__ | ||
|
||
_logger = _getLogger(__name__) | ||
|
||
# This is the basic Core ML specification format understood by iOS 11.0 | ||
SPECIFICATION_VERSION = 1 | ||
|
||
# New versions for iOS 11.2 features. Models which use these features should have these | ||
# versions, but models created from this coremltools which do not use the features can | ||
# still have the basic version. | ||
_MINIMUM_CUSTOM_LAYER_SPEC_VERSION = 2 | ||
_MINIMUM_FP16_SPEC_VERSION = 2 | ||
|
||
# New versions for iOS 12.0 features. Models which use these features should have these | ||
# versions, but models created from this coremltools which do not use the features can | ||
# still have the basic version. | ||
_MINIMUM_CUSTOM_MODEL_SPEC_VERSION = 3 | ||
_MINIMUM_QUANTIZED_MODEL_SPEC_VERSION = 3 | ||
_MINIMUM_FLEXIBLE_SHAPES_SPEC_VERSION = 3 | ||
|
||
# New versions for iOS 13.0. | ||
_MINIMUM_NDARRAY_SPEC_VERSION = 4 | ||
_MINIMUM_NEAREST_NEIGHBORS_SPEC_VERSION = 4 | ||
_MINIMUM_LINKED_MODELS_SPEC_VERSION = 4 | ||
_MINIMUM_UPDATABLE_SPEC_VERSION = 4 | ||
_SPECIFICATION_VERSION_IOS_13 = 4 | ||
|
||
# New versions for iOS 14.0 | ||
_SPECIFICATION_VERSION_IOS_14 = 5 | ||
|
||
# New versions for iOS 15.0 | ||
_SPECIFICATION_VERSION_IOS_15 = 6 | ||
|
||
# New versions for iOS 16.0 | ||
_SPECIFICATION_VERSION_IOS_16 = 7 | ||
|
||
class ComputeUnit(_Enum): | ||
''' | ||
The set of processing-unit configurations the model can use to make predictions. | ||
''' | ||
ALL = 1 # Allows the model to use all compute units available, including the neural engine | ||
CPU_AND_GPU = 2 # Allows the model to use both the CPU and GPU, but not the neural engine | ||
CPU_ONLY = 3 # Limit the model to only use the CPU | ||
CPU_AND_NE = 4 # Allows the model to use both the CPU and neural engine, but not the GPU. | ||
# Only available on macOS >= 13.0 | ||
|
||
# A dictionary that maps the CoreML model specification version to the MLProgram/MIL opset string | ||
_OPSET = { | ||
_SPECIFICATION_VERSION_IOS_13: "CoreML3", | ||
_SPECIFICATION_VERSION_IOS_14: "CoreML4", | ||
_SPECIFICATION_VERSION_IOS_15: "CoreML5", | ||
_SPECIFICATION_VERSION_IOS_16: "CoreML6", | ||
} | ||
|
||
# Default specification version for each backend | ||
_LOWEST_ALLOWED_SPECIFICATION_VERSION_FOR_NEURALNETWORK = _SPECIFICATION_VERSION_IOS_13 | ||
_LOWEST_ALLOWED_SPECIFICATION_VERSION_FOR_MILPROGRAM = _SPECIFICATION_VERSION_IOS_15 | ||
|
||
|
||
# expose sub packages as directories | ||
from . import converters, models, proto | ||
|
||
# expose unified converter in coremltools package level | ||
from .converters import ClassifierConfig | ||
from .converters import ColorLayout as colorlayout | ||
from .converters import EnumeratedShapes, ImageType, RangeDim, Shape, TensorType, convert | ||
from .converters.mil._deployment_compatibility import AvailableTarget as target | ||
from .converters.mil.mil.passes.defs import quantization as transform | ||
from .converters.mil.mil.passes.pass_pipeline import PassPipeline | ||
from .converters.mil.mil.passes.defs.quantization import ComputePrecision as precision | ||
from .models import utils | ||
from .models.ml_program import compression_utils | ||
|
||
try: | ||
from . import libcoremlpython | ||
except: | ||
pass | ||
|
||
# Time profiling for functions in coremltools package, decorated with @profile | ||
import os as _os | ||
import sys as _sys | ||
|
||
from .converters._profile_utils import _profiler | ||
|
||
_ENABLE_PROFILING = _os.environ.get("ENABLE_PROFILING", False) | ||
|
||
if _ENABLE_PROFILING: | ||
_sys.setprofile(_profiler) |
179 changes: 179 additions & 0 deletions
179
__packaged__/coreml/.python_dependencies/coremltools/_deps/__init__.py
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,179 @@ | ||
# 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 the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause | ||
|
||
""" | ||
List of all external dependancies for this package. Imported as | ||
optional includes | ||
""" | ||
import platform as _platform | ||
import re as _re | ||
import sys as _sys | ||
from distutils.version import StrictVersion as _StrictVersion | ||
|
||
from packaging import version | ||
|
||
from coremltools import _logger as logger | ||
|
||
|
||
def _get_version(version): | ||
# matching 1.6.1, and 1.6.1rc, 1.6.1.dev | ||
version_regex = r"^\d+\.\d+\.\d+" | ||
version = _re.search(version_regex, str(version)).group(0) | ||
return _StrictVersion(version) | ||
|
||
|
||
def _warn_if_above_max_supported_version(package_name, package_version, max_supported_version): | ||
if _get_version(package_version) > _StrictVersion(max_supported_version): | ||
logger.warning( | ||
"%s version %s has not been tested with coremltools. You may run into unexpected errors. " | ||
"%s %s is the most recent version that has been tested." | ||
% (package_name, package_version, package_name, max_supported_version) | ||
) | ||
|
||
|
||
# --------------------------------------------------------------------------------------- | ||
|
||
_IS_MACOS = _sys.platform == "darwin" | ||
_MACOS_VERSION = () | ||
|
||
if _IS_MACOS: | ||
ver_str = _platform.mac_ver()[0] | ||
MACOS_VERSION = tuple([int(v) for v in ver_str.split(".")]) | ||
|
||
MSG_ONLY_MACOS = "Only supported on macOS" | ||
|
||
# --------------------------------------------------------------------------------------- | ||
_HAS_SKLEARN = True | ||
_SKLEARN_VERSION = None | ||
_SKLEARN_MIN_VERSION = "0.17" | ||
_SKLEARN_MAX_VERSION = "1.1.2" | ||
|
||
|
||
def __get_sklearn_version(version): | ||
# matching 0.15b, 0.16bf, etc | ||
version_regex = r"^\d+\.\d+" | ||
version = _re.search(version_regex, str(version)).group(0) | ||
return _StrictVersion(version) | ||
|
||
|
||
try: | ||
import sklearn | ||
|
||
_SKLEARN_VERSION = __get_sklearn_version(sklearn.__version__) | ||
if _SKLEARN_VERSION < _StrictVersion( | ||
_SKLEARN_MIN_VERSION | ||
) or _SKLEARN_VERSION > _StrictVersion(_SKLEARN_MAX_VERSION): | ||
_HAS_SKLEARN = False | ||
logger.warning( | ||
( | ||
"scikit-learn version %s is not supported. Minimum required version: %s. " | ||
"Maximum required version: %s. " | ||
"Disabling scikit-learn conversion API." | ||
) | ||
% (sklearn.__version__, _SKLEARN_MIN_VERSION, _SKLEARN_MAX_VERSION) | ||
) | ||
except: | ||
_HAS_SKLEARN = False | ||
MSG_SKLEARN_NOT_FOUND = "Sklearn not found." | ||
|
||
# --------------------------------------------------------------------------------------- | ||
_HAS_LIBSVM = True | ||
try: | ||
from libsvm import svm | ||
except: | ||
_HAS_LIBSVM = False | ||
MSG_LIBSVM_NOT_FOUND = "Libsvm not found." | ||
|
||
# --------------------------------------------------------------------------------------- | ||
_HAS_XGBOOST = True | ||
_XGBOOST_MAX_VERSION = "1.4.2" | ||
try: | ||
import xgboost | ||
_warn_if_above_max_supported_version("XGBoost", xgboost.__version__, _XGBOOST_MAX_VERSION) | ||
except: | ||
_HAS_XGBOOST = False | ||
|
||
# --------------------------------------------------------------------------------------- | ||
_HAS_TF = True | ||
_HAS_TF_1 = False | ||
_HAS_TF_2 = False | ||
_TF_1_MIN_VERSION = "1.12.0" | ||
_TF_1_MAX_VERSION = "1.15.4" | ||
_TF_2_MIN_VERSION = "2.1.0" | ||
_TF_2_MAX_VERSION = "2.12.0" | ||
|
||
try: | ||
import tensorflow | ||
|
||
tf_ver = _get_version(tensorflow.__version__) | ||
|
||
# TensorFlow | ||
if tf_ver < _StrictVersion("2.0.0"): | ||
_HAS_TF_1 = True | ||
|
||
if tf_ver >= _StrictVersion("2.0.0"): | ||
_HAS_TF_2 = True | ||
|
||
if _HAS_TF_1: | ||
if tf_ver < _StrictVersion(_TF_1_MIN_VERSION): | ||
logger.warning( | ||
( | ||
"TensorFlow version %s is not supported. Minimum required version: %s ." | ||
"TensorFlow conversion will be disabled." | ||
) | ||
% (tensorflow.__version__, _TF_1_MIN_VERSION) | ||
) | ||
_warn_if_above_max_supported_version("TensorFlow", tensorflow.__version__, _TF_1_MAX_VERSION) | ||
elif _HAS_TF_2: | ||
if tf_ver < _StrictVersion(_TF_2_MIN_VERSION): | ||
logger.warning( | ||
( | ||
"TensorFlow version %s is not supported. Minimum required version: %s ." | ||
"TensorFlow conversion will be disabled." | ||
) | ||
% (tensorflow.__version__, _TF_2_MIN_VERSION) | ||
) | ||
_warn_if_above_max_supported_version("TensorFlow", tensorflow.__version__, _TF_2_MAX_VERSION) | ||
|
||
except: | ||
_HAS_TF = False | ||
_HAS_TF_1 = False | ||
_HAS_TF_2 = False | ||
|
||
MSG_TF1_NOT_FOUND = "TensorFlow 1.x not found." | ||
MSG_TF2_NOT_FOUND = "TensorFlow 2.x not found." | ||
|
||
# --------------------------------------------------------------------------------------- | ||
_HAS_TORCH = True | ||
_TORCH_MAX_VERSION = "2.0.0" | ||
try: | ||
import torch | ||
_warn_if_above_max_supported_version("Torch", torch.__version__, _TORCH_MAX_VERSION) | ||
except: | ||
_HAS_TORCH = False | ||
MSG_TORCH_NOT_FOUND = "PyTorch not found." | ||
|
||
|
||
# --------------------------------------------------------------------------------------- | ||
try: | ||
import scipy | ||
except: | ||
_HAS_SCIPY = False | ||
else: | ||
_HAS_SCIPY = True | ||
|
||
# General utils | ||
def version_ge(module, target_version): | ||
""" | ||
Example usage: | ||
>>> import torch # v1.5.0 | ||
>>> version_ge(torch, '1.6.0') # False | ||
""" | ||
return version.parse(module.__version__) >= version.parse(target_version) | ||
|
||
def version_lt(module, target_version): | ||
"""See version_ge""" | ||
return version.parse(module.__version__) < version.parse(target_version) |
19 changes: 19 additions & 0 deletions
19
__packaged__/coreml/.python_dependencies/coremltools/converters/__init__.py
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 the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause | ||
|
||
# expose directories as imports | ||
from . import libsvm | ||
from . import sklearn | ||
from . import xgboost | ||
from ._converters_entry import convert | ||
from .mil import ( | ||
ClassifierConfig, | ||
ColorLayout, | ||
TensorType, | ||
ImageType, | ||
RangeDim, | ||
Shape, | ||
EnumeratedShapes, | ||
) |
Oops, something went wrong.