Skip to content

Commit

Permalink
6.3 Release (#1812)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
TobyRoseman committed Apr 3, 2023
1 parent 230f1e5 commit d9123f2
Show file tree
Hide file tree
Showing 418 changed files with 67,511 additions and 24,938 deletions.
51 changes: 21 additions & 30 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ check_python_flake8:
paths:
- build/dist/

build_wheel_macos_py36:
<<: *build_macos
variables:
PYTHON: "3.6"

build_wheel_macos_py37:
<<: *build_macos
variables:
Expand All @@ -62,40 +57,35 @@ build_wheel_macos_py39:
##
#########################################################################
.test_macos_pkg: &test_macos_pkg
stage: test
timeout: 9h
script:
- zsh -e scripts/test.sh --wheel-path=${WHEEL_PATH} --python=${PYTHON}
--test-package=${TEST_PACKAGE} --fast

.test_macos_pkg_with_reqs: &test_macos_pkg_with_reqs
stage: test
timeout: 12h
script:
- zsh -e scripts/test.sh --wheel-path=${WHEEL_PATH} --python=${PYTHON}
--test-package=${TEST_PACKAGE} --requirements=${REQUIREMENTS} --fast

test_py37_coremltools_test:
test_py39_coremltools_test:
<<: *test_macos_pkg
tags:
- macos12
dependencies:
- build_wheel_macos_py37
- build_wheel_macos_py39
variables:
WHEEL_PATH: build/dist/*cp37*10_15*
WHEEL_PATH: build/dist/*cp39*10_15*
TEST_PACKAGE: coremltools.test
PYTHON: "3.7"
PYTHON: "3.9"
REQUIREMENTS: reqs/test.pip

test_py37_pytorch:
test_py39_pytorch:
<<: *test_macos_pkg
tags:
- macos12
dependencies:
- build_wheel_macos_py37
- build_wheel_macos_py39
variables:
PYTHON: "3.7"
PYTHON: "3.9"
TEST_PACKAGE: coremltools.converters.mil.frontend.torch
WHEEL_PATH: build/dist/*cp37*10_15*
WHEEL_PATH: build/dist/*cp39*10_15*
REQUIREMENTS: reqs/test.pip

test_py37_tf1:
<<: *test_macos_pkg
Expand All @@ -107,29 +97,31 @@ test_py37_tf1:
PYTHON: "3.7"
TEST_PACKAGE: coremltools.converters.mil.frontend.tensorflow
WHEEL_PATH: build/dist/*cp37*10_15*
REQUIREMENTS: reqs/test_tf1.pip

test_py37_tf2:
<<: *test_macos_pkg_with_reqs
test_py39_tf2:
<<: *test_macos_pkg
tags:
- macos12
dependencies:
- build_wheel_macos_py37
- build_wheel_macos_py39
variables:
PYTHON: "3.7"
PYTHON: "3.9"
TEST_PACKAGE: coremltools.converters.mil.frontend.tensorflow2
WHEEL_PATH: build/dist/*cp37*10_15*
WHEEL_PATH: build/dist/*cp39*10_15*
REQUIREMENTS: reqs/test.pip

test_py37_mil:
test_py39_mil:
<<: *test_macos_pkg
tags:
- macos12
dependencies:
- build_wheel_macos_py37
- build_wheel_macos_py39
variables:
PYTHON: "3.7"
PYTHON: "3.9"
TEST_PACKAGE: coremltools.converters.mil.mil
WHEEL_PATH: build/dist/*cp37*10_15*
WHEEL_PATH: build/dist/*cp39*10_15*
REQUIREMENTS: reqs/test.pip

#########################################################################
##
Expand Down Expand Up @@ -166,7 +158,6 @@ collect_artifacts:
script:
echo "Collect artifacts (wheels and documentation)"
dependencies:
- build_wheel_macos_py36
- build_wheel_macos_py37
- build_wheel_macos_py38
- build_wheel_macos_py39
Expand Down
9 changes: 4 additions & 5 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ Follow these steps:

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

2. Run the [build.sh](scripts/build.sh) script to build `coremltools`.
* 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.
2. Run the [build.sh](scripts/build.sh) script to build `coremltools`.
* 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.
* The script creates a new `build` folder with the coremltools distribution, and a `dist` folder with Python wheel files.

3. Run the [test.sh](scripts/test.sh) script to test the build.

**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`.
Expand All @@ -45,7 +45,7 @@ The following build targets help you configure the development environment. If y
* `test_slow` | Run all non-fast tests.
* `wheel` | Build wheels in release mode.

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.
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.

## Resources

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

55 changes: 0 additions & 55 deletions a.patch

This file was deleted.

27 changes: 10 additions & 17 deletions coremltools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,18 @@ class ComputeUnit(_Enum):


# expose sub packages as directories
from . import converters
from . import proto
from . import models
from .models import utils
from .models.ml_program import compression_utils
from . import converters, models, proto

# expose unified converter in coremltools package level
from .converters import convert
from .converters import (
ClassifierConfig,
ColorLayout as colorlayout,
TensorType,
ImageType,
RangeDim,
Shape,
EnumeratedShapes,
)
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 import quantization_passes as transform
from .converters.mil.mil.passes.quantization_passes import ComputePrecision as precision
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
Expand All @@ -113,6 +105,7 @@ class ComputeUnit(_Enum):
# 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)
Expand Down
4 changes: 2 additions & 2 deletions coremltools/_deps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __get_sklearn_version(version):
_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.10.0"
_TF_2_MAX_VERSION = "2.12.0"

try:
import tensorflow
Expand Down Expand Up @@ -147,7 +147,7 @@ def __get_sklearn_version(version):

# ---------------------------------------------------------------------------------------
_HAS_TORCH = True
_TORCH_MAX_VERSION = "1.13.1"
_TORCH_MAX_VERSION = "2.0.0"
try:
import torch
_warn_if_above_max_supported_version("Torch", torch.__version__, _TORCH_MAX_VERSION)
Expand Down
Loading

0 comments on commit d9123f2

Please sign in to comment.