Skip to content

Commit d9123f2

Browse files
authored
6.3 Release (#1812)
# Release 6.3 * Torch 2.0 Support * TensorFlow 2.12.0 Support * Remove Python 3.6 support * Functionality for controling graph passes/optimizations, see the `pass_pipeline` parameter to `coremltools.convert`. * A utility function for easily creating pipeline, see: `utils.make_pipeline`. * A debug utility function for extracting submodels, see: `converters.mil.debugging_utils.extract_submodel` * Various other bug fixes, enhancements, clean ups and optimizations.
1 parent 230f1e5 commit d9123f2

File tree

418 files changed

+67511
-24938
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

418 files changed

+67511
-24938
lines changed

.gitlab-ci.yml

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ check_python_flake8:
3636
paths:
3737
- build/dist/
3838

39-
build_wheel_macos_py36:
40-
<<: *build_macos
41-
variables:
42-
PYTHON: "3.6"
43-
4439
build_wheel_macos_py37:
4540
<<: *build_macos
4641
variables:
@@ -62,40 +57,35 @@ build_wheel_macos_py39:
6257
##
6358
#########################################################################
6459
.test_macos_pkg: &test_macos_pkg
65-
stage: test
66-
timeout: 9h
67-
script:
68-
- zsh -e scripts/test.sh --wheel-path=${WHEEL_PATH} --python=${PYTHON}
69-
--test-package=${TEST_PACKAGE} --fast
70-
71-
.test_macos_pkg_with_reqs: &test_macos_pkg_with_reqs
7260
stage: test
7361
timeout: 12h
7462
script:
7563
- zsh -e scripts/test.sh --wheel-path=${WHEEL_PATH} --python=${PYTHON}
7664
--test-package=${TEST_PACKAGE} --requirements=${REQUIREMENTS} --fast
7765

78-
test_py37_coremltools_test:
66+
test_py39_coremltools_test:
7967
<<: *test_macos_pkg
8068
tags:
8169
- macos12
8270
dependencies:
83-
- build_wheel_macos_py37
71+
- build_wheel_macos_py39
8472
variables:
85-
WHEEL_PATH: build/dist/*cp37*10_15*
73+
WHEEL_PATH: build/dist/*cp39*10_15*
8674
TEST_PACKAGE: coremltools.test
87-
PYTHON: "3.7"
75+
PYTHON: "3.9"
76+
REQUIREMENTS: reqs/test.pip
8877

89-
test_py37_pytorch:
78+
test_py39_pytorch:
9079
<<: *test_macos_pkg
9180
tags:
9281
- macos12
9382
dependencies:
94-
- build_wheel_macos_py37
83+
- build_wheel_macos_py39
9584
variables:
96-
PYTHON: "3.7"
85+
PYTHON: "3.9"
9786
TEST_PACKAGE: coremltools.converters.mil.frontend.torch
98-
WHEEL_PATH: build/dist/*cp37*10_15*
87+
WHEEL_PATH: build/dist/*cp39*10_15*
88+
REQUIREMENTS: reqs/test.pip
9989

10090
test_py37_tf1:
10191
<<: *test_macos_pkg
@@ -107,29 +97,31 @@ test_py37_tf1:
10797
PYTHON: "3.7"
10898
TEST_PACKAGE: coremltools.converters.mil.frontend.tensorflow
10999
WHEEL_PATH: build/dist/*cp37*10_15*
100+
REQUIREMENTS: reqs/test_tf1.pip
110101

111-
test_py37_tf2:
112-
<<: *test_macos_pkg_with_reqs
102+
test_py39_tf2:
103+
<<: *test_macos_pkg
113104
tags:
114105
- macos12
115106
dependencies:
116-
- build_wheel_macos_py37
107+
- build_wheel_macos_py39
117108
variables:
118-
PYTHON: "3.7"
109+
PYTHON: "3.9"
119110
TEST_PACKAGE: coremltools.converters.mil.frontend.tensorflow2
120-
WHEEL_PATH: build/dist/*cp37*10_15*
111+
WHEEL_PATH: build/dist/*cp39*10_15*
121112
REQUIREMENTS: reqs/test.pip
122113

123-
test_py37_mil:
114+
test_py39_mil:
124115
<<: *test_macos_pkg
125116
tags:
126117
- macos12
127118
dependencies:
128-
- build_wheel_macos_py37
119+
- build_wheel_macos_py39
129120
variables:
130-
PYTHON: "3.7"
121+
PYTHON: "3.9"
131122
TEST_PACKAGE: coremltools.converters.mil.mil
132-
WHEEL_PATH: build/dist/*cp37*10_15*
123+
WHEEL_PATH: build/dist/*cp39*10_15*
124+
REQUIREMENTS: reqs/test.pip
133125

134126
#########################################################################
135127
##
@@ -166,7 +158,6 @@ collect_artifacts:
166158
script:
167159
echo "Collect artifacts (wheels and documentation)"
168160
dependencies:
169-
- build_wheel_macos_py36
170161
- build_wheel_macos_py37
171162
- build_wheel_macos_py38
172163
- build_wheel_macos_py39

BUILDING.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ Follow these steps:
1818

1919
1. Fork and clone the GitHub [coremltools repository](https://github.com/apple/coremltools).
2020

21-
2. Run the [build.sh](scripts/build.sh) script to build `coremltools`.
22-
* By default this script uses Python 3.7, but you can include `--python=3.6` (or `3.7`, `3.8`, `3.9`, `3.10`) as a argument to change the Python version.
21+
2. Run the [build.sh](scripts/build.sh) script to build `coremltools`.
22+
* By default this script uses Python 3.7, but you can include `--python=3.8` (or `3.9`, `3.10`) as a argument to change the Python version.
2323
* The script creates a new `build` folder with the coremltools distribution, and a `dist` folder with Python wheel files.
24-
24+
2525
3. Run the [test.sh](scripts/test.sh) script to test the build.
2626

2727
**Under the hood**: If an Anaconda or Miniconda environment doesn't already exist or is not up-to-date, the `build.sh` script automatically runs the [`env_create.sh`](scripts/env_create.sh) script to create the environment. It then uses [`env_activate.sh`](scripts/env_activate.sh) to activate the environment and set up the appropriate version of Python. The new environment is located at `<repo root>/coremltoos/envs` and is named after the `py` parameter. For example, a development environment with py 3.7 is named `coremltools-dev-py37`.
@@ -45,7 +45,7 @@ The following build targets help you configure the development environment. If y
4545
* `test_slow` | Run all non-fast tests.
4646
* `wheel` | Build wheels in release mode.
4747

48-
The script uses Python 3.7, but you can include `--python=3.6` (or `3.7`, `3.8`, `3.9`, `3.10`) as a argument to change the Python version.
48+
The script uses Python 3.7, but you can include `--python=3.8` (or `3.9`, `3.10`) as a argument to change the Python version.
4949

5050
## Resources
5151

@@ -57,4 +57,3 @@ For more information, see the following:
5757
* [API Reference](https://apple.github.io/coremltools/index.html)
5858
* [Core ML Specification](https://apple.github.io/coremltools/mlmodel/index.html)
5959
* [Contribution Guidelines](CONTRIBUTING.md) for reporting issues and making pull requests
60-

a.patch

Lines changed: 0 additions & 55 deletions
This file was deleted.

coremltools/__init__.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,18 @@ class ComputeUnit(_Enum):
8484

8585

8686
# expose sub packages as directories
87-
from . import converters
88-
from . import proto
89-
from . import models
90-
from .models import utils
91-
from .models.ml_program import compression_utils
87+
from . import converters, models, proto
9288

9389
# expose unified converter in coremltools package level
94-
from .converters import convert
95-
from .converters import (
96-
ClassifierConfig,
97-
ColorLayout as colorlayout,
98-
TensorType,
99-
ImageType,
100-
RangeDim,
101-
Shape,
102-
EnumeratedShapes,
103-
)
90+
from .converters import ClassifierConfig
91+
from .converters import ColorLayout as colorlayout
92+
from .converters import EnumeratedShapes, ImageType, RangeDim, Shape, TensorType, convert
10493
from .converters.mil._deployment_compatibility import AvailableTarget as target
105-
from .converters.mil.mil.passes import quantization_passes as transform
106-
from .converters.mil.mil.passes.quantization_passes import ComputePrecision as precision
94+
from .converters.mil.mil.passes.defs import quantization as transform
95+
from .converters.mil.mil.passes.pass_pipeline import PassPipeline
96+
from .converters.mil.mil.passes.defs.quantization import ComputePrecision as precision
97+
from .models import utils
98+
from .models.ml_program import compression_utils
10799

108100
try:
109101
from . import libcoremlpython
@@ -113,6 +105,7 @@ class ComputeUnit(_Enum):
113105
# Time profiling for functions in coremltools package, decorated with @profile
114106
import os as _os
115107
import sys as _sys
108+
116109
from .converters._profile_utils import _profiler
117110

118111
_ENABLE_PROFILING = _os.environ.get("ENABLE_PROFILING", False)

coremltools/_deps/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def __get_sklearn_version(version):
102102
_TF_1_MIN_VERSION = "1.12.0"
103103
_TF_1_MAX_VERSION = "1.15.4"
104104
_TF_2_MIN_VERSION = "2.1.0"
105-
_TF_2_MAX_VERSION = "2.10.0"
105+
_TF_2_MAX_VERSION = "2.12.0"
106106

107107
try:
108108
import tensorflow
@@ -147,7 +147,7 @@ def __get_sklearn_version(version):
147147

148148
# ---------------------------------------------------------------------------------------
149149
_HAS_TORCH = True
150-
_TORCH_MAX_VERSION = "1.13.1"
150+
_TORCH_MAX_VERSION = "2.0.0"
151151
try:
152152
import torch
153153
_warn_if_above_max_supported_version("Torch", torch.__version__, _TORCH_MAX_VERSION)

0 commit comments

Comments
 (0)