unitorch provides efficient implementation of popular unified NLU / NLG / CV / CTR / MM / RL models with PyTorch.
Project description
Introduction
🔥 unitorch is a PyTorch-based library that unifies training, inference, and serving of state-of-the-art models across NLP, computer vision, multimodal learning, and more. It wraps 20+ model architectures with a configuration-driven CLI, integrating seamlessly with transformers, peft, and diffusers.
Get started with a single import or a one-line CLI command — no boilerplate required.
Features
| Unified Model Support | 20+ architectures: LLMs, diffusion models, vision transformers, multimodal models |
| Configuration-Driven CLI | Train, evaluate, infer, and serve via .ini config files |
| Multi-GPU & Distributed | Native torchrun support + DeepSpeed integration for large-scale models |
| CUDA Optimized | Optional CUDA C++ extensions for accelerated kernels |
| PEFT / LoRA | Built-in parameter-efficient fine-tuning support |
| Model Serving | FastAPI-based serving with unitorch-fastapi |
Installation
pip install unitorch
Optional extras
pip install "unitorch[all]" # everything
pip install "unitorch[deepspeed]" # DeepSpeed support
pip install "unitorch[diffusers]" # image generation models
Requires Python >= 3.10 and PyTorch 2.5+.
Quick Start
Python API
from unitorch.models.bart import BartForGeneration
model = BartForGeneration("path/to/bart/config.json")
# Configuration-driven setup
from unitorch.cli import Config
config = Config("path/to/config.ini")
Multi-GPU Training
torchrun --no_python --nproc_per_node 4 \
unitorch-train examples/configs/generation/bart.ini \
--train_file path/to/train.tsv --dev_file path/to/dev.tsv
Inference
unitorch-infer examples/configs/generation/bart.ini --test_file path/to/test.tsv
See the documentation for full tutorials and examples.
Supported Models
View all supported models
| Domain | Models |
|---|---|
| Language | BERT, RoBERTa, XLM-RoBERTa, BART, MBart, LLaMA, Mistral, QWen3 |
| Vision | BEiT, Swin Transformer, DINOv2, CLIP, SigLIP |
| Multimodal | LLaVA, QWen3-VL, Chinese CLIP |
| Image Generation | FLUX (StableFlux), QWenImage |
| Video Generation | Wan |
| Detection | DETR, Grounding DINO |
| Segmentation | SAM, Mask2Former, SegFormer, BRIA |
| Depth Estimation | DPT |
| PEFT | LoRA, DPO, GRPO (via peft wrappers) |
CLI Commands
| Command | Purpose |
|---|---|
unitorch-train |
Train models (supports torchrun) |
unitorch-eval |
Evaluate models |
unitorch-infer |
Run batch inference |
unitorch-fastapi |
Start a FastAPI model server |
unitorch-copilot |
unitorch-native agent (similar to Claude / OpenCode) |
unitorch-copilot-cli |
CLI tool for agent use — invokes registered copilot tools |
License
Released under the MIT 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 unitorch-0.0.2.0.tar.gz.
File metadata
- Download URL: unitorch-0.0.2.0.tar.gz
- Upload date:
- Size: 11.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b7128d0dcbd78ab59542986ca1013fc4c30b8a2829a82a103161a5d628be0fd
|
|
| MD5 |
ecd688a0eaea1b995679d5cba4b1607e
|
|
| BLAKE2b-256 |
d10e094e1fbda72fb2197b86674c788ab996ebbf53f789b4f18881eefc403054
|
File details
Details for the file unitorch-0.0.2.0-py3-none-any.whl.
File metadata
- Download URL: unitorch-0.0.2.0-py3-none-any.whl
- Upload date:
- Size: 477.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fee01f3f1bd0020cfb524d7b073e9650afc6b634554493ce278981641a0d03d
|
|
| MD5 |
3a8b12235867dc68af5168225da89f02
|
|
| BLAKE2b-256 |
ba83c82a11afb64db62d5a54f42de46bca650b4d8902e204b4c639dfe2be17a8
|