Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 68ae479

Browse files
authored
Merge pull request #518 from aseemw/dev/bump_version_1.1
Bump version to 1.1
2 parents 7a630c1 + 237fdaa commit 68ae479

File tree

6 files changed

+50
-3372
lines changed

6 files changed

+50
-3372
lines changed

README.md

Lines changed: 43 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -4,72 +4,30 @@
44

55
This tool converts [ONNX](https://onnx.ai/) models to Apple Core ML format. To convert Core ML models to ONNX, use [ONNXMLTools](https://github.com/onnx/onnxmltools).
66

7-
There's a comprehensive [Tutorial](https://github.com/onnx/tutorials/tree/master/examples/CoreML/ONNXLive/README.md) showing how to convert PyTorch style transfer models through ONNX to Core ML models and run them in an iOS app. You can find example for PyTorch model conversion [here](https://github.com/onnx/onnx-coreml/tree/master/examples).
7+
There's a comprehensive [Tutorial](https://github.com/onnx/tutorials/tree/master/examples/CoreML/ONNXLive/README.md) showing
8+
how to convert PyTorch style transfer models through ONNX to Core ML models and run them in an iOS app.
89

9-
## [New] release onnx-coreml converter with Core ML 3
10-
11-
To try out the new onnx-coreml 1.0 converter with Core ML 3 (>= iOS 13, >= macOS 15),
12-
install coremltools 3.0 and coremltools 1.0
10+
To get the latest version of `onnx-coreml` from PyPI:
1311

1412
```shell
15-
pip install coremltools==3.0
16-
pip install onnx-coreml==1.0
17-
```
18-
19-
Since 1.0 beta 3, the flag `disable_coreml_rank5_mapping` (which was part of beta 2) has been removed and instead replaced by
20-
the generic argument `minimum_ios_deployment_target` which can be used to target different versions of Core ML/iOS.
21-
The argument `minimum_ios_deployment_target` takes a string specifying the target deployment iOS version e.g. '11.2', '12' and '13'.
22-
By default, the converter uses the value of '12'.
23-
24-
For example:
25-
26-
```python
27-
from onnx_coreml import convert
28-
ml_model = convert(model='my_model.onnx', minimum_ios_deployment_target='13') # to use Core ML 3
13+
pip install --upgrade onnx-coreml
14+
pip install --upgrade coremltools # onnx-coreml depends on the coremltools package
2915
```
3016

31-
## Installation
17+
For the latest changes please see the [release notes](https://github.com/onnx/onnx-coreml/releases).
3218

33-
### Install From PyPI
34-
35-
```bash
36-
pip install -U onnx-coreml
37-
```
19+
To get the latest version from source (master branch of this repository), please see the [installation section](#Installation).
3820

39-
### Install From Source
21+
## Usage
4022

41-
To get the latest version of the converter, install from source by cloning the repository along with its submodules and running the install.sh script. That is,
23+
Please see the ONNX conversion section in the [Neural network guide](https://github.com/apple/coremltools/blob/master/docs/NeuralNetworkGuide.md)
24+
on how to use the converter.
4225

43-
```bash
44-
git clone --recursive https://github.com/onnx/onnx-coreml.git
45-
cd onnx-coreml
46-
./install.sh
47-
```
26+
There are a few [notebook examples](https://github.com/apple/coremltools/tree/master/examples/neural_network_inference)
27+
as well for reference.
4828

49-
### Install From Source (for contributors)
5029

51-
To get the latest version of the converter, install from source by cloning the repository along with its submodules and running the install-develop.sh script. That is,
52-
53-
```bash
54-
git clone --recursive https://github.com/onnx/onnx-coreml.git
55-
cd onnx-coreml
56-
./install-develop.sh
57-
```
58-
59-
## Dependencies
60-
61-
* click
62-
* numpy
63-
* coremltools (3.0+)
64-
* onnx (1.5.0+)
65-
66-
## How to Use
67-
68-
To convert models use single function `convert` from onnx_coreml:
69-
70-
```python
71-
from onnx_coreml import convert
72-
```
30+
### Parameters
7331

7432
```python
7533
def convert(model,
@@ -85,31 +43,6 @@ def convert(model,
8543
minimum_ios_deployment_target='12')
8644
```
8745

88-
The function returns a Core ML model instance that can be saved to a `.mlmodel` file, e.g.:
89-
90-
```python
91-
mlmodel = convert(onnx_model)
92-
mlmodel.save('model.mlmodel')
93-
```
94-
95-
Core ML model spec can be obtained from the model instance, which can be used to update model properties such as output names, input names etc. For e.g.:
96-
97-
```python
98-
import coremltools
99-
from coremltools.models import MLModel
100-
101-
spec = mlmodel.get_spec()
102-
new_mlmodel = MLModel(spec)
103-
coremltools.utils.rename_feature(spec, 'old_output_name', 'new_output_name')
104-
coremltools.utils.save_spec(spec, 'model_new_output_name.mlmodel')
105-
```
106-
107-
Please see the ONNX conversion section in the [Neural network guide](https://github.com/apple/coremltools/blob/master/docs/NeuralNetworkGuide.md) on how to use the converter.
108-
109-
There are several [notebook examples](https://github.com/apple/coremltools/tree/master/examples/neural_network_inference/onnx_converter) as well for reference.
110-
111-
### Parameters
112-
11346
```
11447
__model__: ONNX model | str
11548
An ONNX model with parameters loaded in onnx package or path to file
@@ -196,6 +129,36 @@ convert-onnx-to-coreml [OPTIONS] ONNX_MODEL
196129

197130
The command-line script currently doesn't support all options mentioned above. For more advanced use cases, you have to call the python function directly.
198131

132+
133+
## Installation
134+
135+
### Install From PyPI
136+
137+
```bash
138+
pip install -U onnx-coreml
139+
```
140+
141+
### Install From Source
142+
143+
To get the latest version of the converter, install from source by cloning the repository along with its submodules and running the install.sh script. That is,
144+
145+
```bash
146+
git clone --recursive https://github.com/onnx/onnx-coreml.git
147+
cd onnx-coreml
148+
./install.sh
149+
```
150+
151+
### Install From Source (for contributors)
152+
153+
To get the latest version of the converter, install from source by cloning the repository along with its submodules and running the install-develop.sh script. That is,
154+
155+
```bash
156+
git clone --recursive https://github.com/onnx/onnx-coreml.git
157+
cd onnx-coreml
158+
./install-develop.sh
159+
```
160+
161+
199162
## Running Unit Tests
200163

201164
In order to run unit tests, you need `pytest`.

0 commit comments

Comments
 (0)