Convert Exported Torch Module To Circle
Project description
TICO
TICO (Torch IR to Circle ONE) is a Python library that converts PyTorch modules into Circle models — a lightweight and efficient representation in ONE designed for optimized on-device neural network inference.
Highlights
- One-call conversion —
tico.convert()turns annn.Moduleinto a ready-to-deploy.circlebinary. .pt2support — convert savedtorch.exportprograms via the Python API or thept2-to-circlecommand-line tool.- Run Circle models in Python — execute converted models directly for quick parity checks against PyTorch.
- Quantization toolkit — a unified
prepare/convertAPI with GPTQ, PTQ (WrapQ), SmoothQuant, SpinQuant, and CLE, plus config-driven CLI recipes for LLMs and VLMs.
Installation
Prerequisites
- Python 3.10+
- (Optional) one-compiler — only required to run inference with converted Circle models. Conversion itself does not need it.
We highly recommend using a virtual environment (e.g., conda, venv).
From PyPI
pip install tico
From source
git clone https://github.com/Samsung/TICO.git
cd TICO
./ccex build # generates build/ and dist/
./ccex install # installs the package
./ccex install options
| Option | Description |
|---|---|
--dist |
Install from the built wheel (default is editable mode) |
--torch_ver <ver> |
Torch version to install: a family (2.5 ~ 2.10), an exact version (e.g. 2.7.0+cu118), or nightly. Default: 2.7 |
--cuda_ver <maj.min> |
Override the detected CUDA version (e.g. 12.1) |
--cpu_only |
Force a CPU-only Torch installation |
Quick start
import tico
import torch
class AddModule(torch.nn.Module):
def forward(self, x, y):
return x + y
torch_module = AddModule()
example_inputs = (torch.ones(4), torch.ones(4))
circle_model = tico.convert(torch_module.eval(), example_inputs)
circle_model.save('add.circle')
[!NOTE] Call
eval()on the module before conversion. TICO internally usestorch.export, so the module must be export-able.
Converting a saved .pt2 file from the command line:
pt2-to-circle -i add.pt2 -o add.circle
See the Getting Started guide for compile configurations,
.pt2 conversion, and running Circle models directly in Python.
Quantization
The tico.quantization module provides a unified,
modular interface for quantizing neural networks — including large language models —
through a simple two-step prepare → convert workflow:
from tico.quantization import prepare, convert
from tico.quantization.config.gptq import GPTQConfig
prepared_model = prepare(model.eval(), GPTQConfig())
for d in dataset: # calibration
prepared_model(d)
quantized_model = convert(prepared_model, GPTQConfig())
- Quantization overview — API, architecture, and how to add a new algorithm
- Quantization algorithms — GPTQ, SmoothQuant, SpinQuant, CLE, …
- Config-driven CLI examples — quantize, evaluate, and inspect LLM/VLM recipes from the command line
Documentation
For users
| Document | Description |
|---|---|
| Getting Started | Converting modules and .pt2 files, compile configuration, running Circle models in Python |
| Quantization | The prepare/convert quantization API and toolkit |
| Quantization examples | Command-line quantization, evaluation, and debugging workflows |
For developers
| Document | Description |
|---|---|
| Development guide | Environment setup, testing, and code formatting with ./ccex |
| System design | Architecture, pass pipeline, invariants, and behavior design |
| Requirements | Functional and non-functional requirements |
| System tests | System-level test coverage |
Contributing
Contributions are welcome! For quantization algorithms, start with the quantization contribution guide and the recipes developer guide. Before submitting a PR, set up the development environment and run the tests and formatter as described in the development guide.
License
Licensed under the Apache License 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tico-0.2.0.dev260702.tar.gz.
File metadata
- Download URL: tico-0.2.0.dev260702.tar.gz
- Upload date:
- Size: 562.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ca24e4764b482f10bde258791db895124fc8391623a45a4c059e5f551aff441
|
|
| MD5 |
f82df2cdd8aef0be5a844417e07d5801
|
|
| BLAKE2b-256 |
6926054adc4092c273d845e38b5f03efd3e8e1249dc26864304832d100ce336d
|
Provenance
The following attestation bundles were made for tico-0.2.0.dev260702.tar.gz:
Publisher:
publish-nightly-package.yaml on Samsung/TICO
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tico-0.2.0.dev260702.tar.gz -
Subject digest:
5ca24e4764b482f10bde258791db895124fc8391623a45a4c059e5f551aff441 - Sigstore transparency entry: 2048651326
- Sigstore integration time:
-
Permalink:
Samsung/TICO@f62677f76732d2d4c97714730cd1a3b4556ea8d0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Samsung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-nightly-package.yaml@f62677f76732d2d4c97714730cd1a3b4556ea8d0 -
Trigger Event:
schedule
-
Statement type:
File details
Details for the file tico-0.2.0.dev260702-py3-none-any.whl.
File metadata
- Download URL: tico-0.2.0.dev260702-py3-none-any.whl
- Upload date:
- Size: 947.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
879d24833f994e9d34677f3ca66610afb210b7c3163a3ce084e1cbb2f337e66c
|
|
| MD5 |
4bf2da7a4d3a6a98c4498d6725f4ba1a
|
|
| BLAKE2b-256 |
c8b5353c867f3ee01a1149eb7e4c0ed181afdd4227c5612d558d753cd17150ed
|
Provenance
The following attestation bundles were made for tico-0.2.0.dev260702-py3-none-any.whl:
Publisher:
publish-nightly-package.yaml on Samsung/TICO
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tico-0.2.0.dev260702-py3-none-any.whl -
Subject digest:
879d24833f994e9d34677f3ca66610afb210b7c3163a3ce084e1cbb2f337e66c - Sigstore transparency entry: 2048651334
- Sigstore integration time:
-
Permalink:
Samsung/TICO@f62677f76732d2d4c97714730cd1a3b4556ea8d0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Samsung
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-nightly-package.yaml@f62677f76732d2d4c97714730cd1a3b4556ea8d0 -
Trigger Event:
schedule
-
Statement type: