Skip to main content

WinMLTools provide following tools for Windows ML:

Model Conversion

WinMLTools enables you to convert models from different machine learning toolkits into ONNX for use with Windows ML. Currently the following toolkits are supported:

  • apple CoreML

  • keras

  • scikit-learn

  • lightgbm

  • xgboost

  • libSVM

  • tensorflow (experimental)

Here is a simple example to convert a Core ML model:

from coremltools.models.utils import load_spec
from winmltools import convert_coreml
model_coreml = load_spec('example.mlmodel')
model_onnx = convert_coreml(model_coreml, 10, name='ExampleModel')

Post Training Weight Quantization

WinMLTools provides quantization tool to reduce the memory footprint of the model.

Here is an example to convert an ONNX model to a quantized ONNX model:

import winmltools

model = winmltools.load_model('model.onnx')
quantized_model = winmltools.quantize(model, per_channel=True, nbits=8, use_dequantize_linear=True)
winmltools.save_model(quantized_model, 'quantized.onnx')

Dependencies

In order to convert from different toolkits, you may have to install the following packages for different converters:

Toolkit

Source

keras

https://pypi.org/project/Keras

tensorflow

https://pypi.org/project/tensorflow

scikit-learn

https://pypi.org/project/scikit-learn

lightgbm

https://pypi.org/project/lightgbm

xgboost

https://pypi.org/project/xgboost

libsvm

You can download libsvm wheel from various web sources. One example can be found here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#libsvm

coremltools

Currenlty coreml does not distribute coreml packaging on windows. You can install from source: pip install git+https://github.com/apple/coremltools

For more information on WinMLTools, you can go to Convert ML models to ONNX with WinMLTools

License

MIT License

Release files for winmltools 1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for winmltools 1.5.1
File Size Uploaded
winmltools-1.5.1.tar.gz 26.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for winmltools 1.5.1
File Interpreter ABI Platform
winmltools-1.5.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 67.6 kB

Release files / winmltools-1.5.1.tar.gz

Download URL winmltools-1.5.1.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
99fce78536866b235715d0489ddbae6df714f8beeae6bb54cae231fbd5e708f1
BLAKE2b-256 checksum
How to use checksums
8f16aa6d07bb7b873659dbe950194895c7253fa74c86b872ee3bb80c3dc7f547
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/3.6.9

Release files / winmltools-1.5.1-py2.py3-none-any.whl

Download URL winmltools-1.5.1-py2.py3-none-any.whl
Size 40.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
af343551272c305151b0f22b2f7d4fa4056b94bc02ebd2afdd378ee9f92e5d63
BLAKE2b-256 checksum
How to use checksums
b7fccbf8213110fdff2fec65ebef9069e927cd2bd737458db67c435fc2a1f96f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.5.1 This release

2 release files

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page