{"id":37067121,"url":"https://github.com/onepunchmonk/oxidized-vision","last_synced_at":"2026-02-14T15:04:11.814Z","repository":{"id":318917926,"uuid":"1076961569","full_name":"OnePunchMonk/Oxidized-Vision","owner":"OnePunchMonk","description":"Compile PyTorch vision models into ultra-fast Rust binaries for edge, server, and browser deployment. (WORK IN PROGRESS )","archived":false,"fork":false,"pushed_at":"2025-10-15T18:23:38.000Z","size":88,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-14T09:33:03.250Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OnePunchMonk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-15T15:23:51.000Z","updated_at":"2025-11-19T20:34:42.000Z","dependencies_parsed_at":"2025-10-17T07:05:50.059Z","dependency_job_id":"00422692-b259-4349-9d7c-7a173d0902af","html_url":"https://github.com/OnePunchMonk/Oxidized-Vision","commit_stats":null,"previous_names":["onepunchmonk/oxidized-vision"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OnePunchMonk/Oxidized-Vision","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnePunchMonk%2FOxidized-Vision","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnePunchMonk%2FOxidized-Vision/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnePunchMonk%2FOxidized-Vision/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnePunchMonk%2FOxidized-Vision/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OnePunchMonk","download_url":"https://codeload.github.com/OnePunchMonk/Oxidized-Vision/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OnePunchMonk%2FOxidized-Vision/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29447768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T14:10:32.461Z","status":"ssl_error","status_checked_at":"2026-02-14T14:09:49.945Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T07:52:45.106Z","updated_at":"2026-02-14T15:04:11.797Z","avatar_url":"https://github.com/OnePunchMonk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 OxidizedVision\n\n[![CI](https://github.com/OnePunchMonk/Oxidized-Vision/actions/workflows/ci.yml/badge.svg)](https://github.com/OnePunchMonk/Oxidized-Vision/actions/workflows/ci.yml)\n[![PyPI](https://img.shields.io/pypi/v/oxidizedvision)](https://pypi.org/project/oxidizedvision/)\n[![Python](https://img.shields.io/pypi/pyversions/oxidizedvision)](https://pypi.org/project/oxidizedvision/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n**Compile your PyTorch models to Rust for ultra-fast, memory-safe inference.**\n\nOxidizedVision is a production-grade toolkit that bridges the gap between Python-based model training and Rust-based deployment. It provides a seamless pipeline to **convert**, **optimize**, **validate**, **benchmark**, **profile**, and **package** your models — from a trained PyTorch `nn.Module` to a deployable Rust binary, REST API, or WebAssembly module.\n\n---\n\n## ✨ Key Features\n\n| Feature | Description |\n|---|---|\n| 🔄 **Model Conversion** | PyTorch → TorchScript → ONNX with a single command |\n| ⚡ **Optimization** | ONNX graph simplification, constant folding, INT8/FP16 quantization |\n| ✅ **Validation** | Numerical consistency checks (MAE, RMSE, Cosine Similarity) across formats |\n| 📊 **Benchmarking** | Latency (avg, p50, p95, p99), throughput, and memory profiling |\n| 🔬 **Profiling** | Parameter count, model size, per-layer breakdown |\n| 📦 **Packaging** | Auto-generate a deployable Rust crate (server or CLI) |\n| 🌐 **Multi-Backend** | `tract` (pure Rust), `tch` (LibTorch), `tensorrt` (NVIDIA GPU) |\n| 🧩 **WASM Support** | Run models in the browser via WebAssembly |\n| 📋 **Model Registry** | Track all converted models and their metadata locally |\n| 🎨 **Rich CLI** | Beautiful terminal output with progress indicators and tables |\n| 🔀 **Multi-Model Server** | Serve multiple models from a single Rust server instance |\n| ⏱️ **Dynamic Batching** | Configurable request batching for efficient inference |\n| 📝 **Structured Logging** | `tracing` (Rust) + Rich/JSON (Python) for full observability |\n| 📈 **Metrics Endpoint** | `/metrics` for monitoring request counts and server health |\n\n---\n\n## 🏗️ Architecture\n\n```\n┌─────────────────────────────────────────────────────────┐\n│                    Python Client (CLI)                   │\n│  convert │ validate │ benchmark │ optimize │ profile    │\n│  package │ serve    │ list      │ info                   │\n│                                                         │\n│  Global: --verbose  │  --json-log                       │\n└────────────────────────┬────────────────────────────────┘\n                         │ Generates\n┌────────────────────────▼────────────────────────────────┐\n│                    Rust Runtimes                         │\n│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────┐ │\n│  │ runner_tch   │  │ runner_tract │  │ runner_tensorrt │ │\n│  │ (LibTorch)   │  │ (Pure Rust)  │  │ (GPU / TensorRT)│ │\n│  └──────┬──────┘  └──────┬──────┘  └───────┬─────────┘ │\n│         │   All implement Runner trait      │           │\n│  ┌──────▼──────────────────▼────────────────▼─────────┐ │\n│  │              runner_core (Shared Trait)             │ │\n│  │          + tracing structured logging              │ │\n│  └────────────────────────────────────────────────────┘ │\n└─────────────────────────────────────────────────────────┘\n                         │ Deploys to\n        ┌────────────────┼────────────────┐\n        ▼                ▼                ▼\n   Native Binary    REST API Server    WASM Module\n                    (multi-model,\n                     batching,\n                     /metrics)\n```\n\n---\n\n## ⚡ Quickstart\n\n### 1. Install\n\n```bash\n# From PyPI\npip install oxidizedvision\n\n# From source (development)\npip install -e \"./python_client[dev]\"\n```\n\n### 2. Create a Config\n\n```yaml\n# config.yml\nmodel:\n  path: examples/example_unet/model.py\n  class_name: UNet\n  input_shape: [1, 3, 256, 256]\n\nexport:\n  output_dir: out\n  model_name: unet\n\nvalidate:\n  tolerance_mae: 1e-4\n  tolerance_cos_sim: 0.999\n\nbenchmark:\n  iters: 100\n  device: cpu\n```\n\n### 3. Run the Pipeline\n\n```bash\n# Convert PyTorch → TorchScript + ONNX\noxidizedvision convert config.yml\n\n# Validate numerical consistency\noxidizedvision validate config.yml\n\n# Optimize the ONNX model\noxidizedvision optimize out/unet.onnx --quantize int8\n\n# Benchmark performance\noxidizedvision benchmark out/unet.pt --runners torchscript,tract\n\n# Profile the model\noxidizedvision profile config.yml\n\n# Package into a Rust crate\noxidizedvision package out/unet.onnx --runner tract --template server\n\n# List registered models\noxidizedvision list\n```\n\n### 4. Debug with Structured Logging\n\n```bash\n# Verbose mode (DEBUG level)\noxidizedvision --verbose convert config.yml\n\n# JSON log output (for CI / log aggregation)\noxidizedvision --json-log convert config.yml\n```\n\n---\n\n## 📖 CLI Reference\n\n| Command | Description | Example |\n|---|---|---|\n| `convert` | Convert PyTorch → TorchScript + ONNX | `oxidizedvision convert config.yml` |\n| `validate` | Check numerical consistency | `oxidizedvision validate config.yml --num-tests 5` |\n| `benchmark` | Measure inference performance | `oxidizedvision benchmark out/model.pt --runners torchscript,tract` |\n| `optimize` | Optimize an ONNX model | `oxidizedvision optimize out/model.onnx --quantize fp16` |\n| `profile` | Analyze model parameters and layers | `oxidizedvision profile config.yml` |\n| `package` | Generate deployable Rust crate | `oxidizedvision package out/model.onnx --template server` |\n| `serve` | Start inference server | `oxidizedvision serve ./binary --port 8080` |\n| `list` | List registered models | `oxidizedvision list` |\n| `info` | Detailed model information | `oxidizedvision info unet` |\n\n### Global Options\n\n| Flag | Description |\n|---|---|\n| `--verbose` / `-v` | Enable DEBUG-level logging |\n| `--json-log` | Emit logs as JSON lines (for CI / production) |\n\n---\n\n## 🦀 Rust Runtimes\n\n### Shared Runner Trait\n\nAll backends implement a common `Runner` trait:\n\n```rust\npub trait Runner: Send + Sync {\n    fn from_config(config: \u0026RunnerConfig) -\u003e Result\u003cSelf\u003e where Self: Sized;\n    fn run(\u0026self, input: \u0026ArrayD\u003cf32\u003e) -\u003e Result\u003cArrayD\u003cf32\u003e\u003e;\n    fn info(\u0026self) -\u003e ModelInfo;\n}\n```\n\n### Available Backends\n\n| Backend | Model Format | GPU | WASM | Dependencies |\n|---|---|---|---|---|\n| `runner_tract` | ONNX | ❌ | ✅ | None (pure Rust) |\n| `runner_tch` | TorchScript | ✅ | ❌ | LibTorch |\n| `runner_tensorrt` | ONNX → Engine | ✅ | ❌ | TensorRT SDK |\n\n---\n\n## 🖥️ Inference Server\n\nThe built-in `image_server` example provides a production-ready REST API:\n\n```bash\n# Single model\ncargo run -p image_server -- --model model.onnx --port 8080\n\n# Multi-model (serve multiple models simultaneously)\ncargo run -p image_server -- \\\n  --model segmenter=models/seg.onnx \\\n  --model classifier=models/cls.onnx \\\n  --port 8080\n\n# With dynamic batching\ncargo run -p image_server -- \\\n  --model model.onnx \\\n  --max-batch-size 8 \\\n  --max-wait-ms 50\n\n# JSON structured logs\ncargo run -p image_server -- --model model.onnx --log-format json\n```\n\n### Endpoints\n\n| Method | Path | Description |\n|---|---|---|\n| `POST` | `/predict` | Inference on the default model |\n| `POST` | `/predict/{model_name}` | Inference on a named model |\n| `GET` | `/health` | Health check with per-model status |\n| `GET` | `/metrics` | Request counts, error counts, batch status |\n| `GET` | `/models` | List all loaded models |\n\n---\n\n## 🗂️ Project Structure\n\n```\nOxidized-Vision/\n├── python_client/             # Python CLI \u0026 pipeline\n│   ├── oxidizedvision/\n│   │   ├── cli.py             # Typer CLI entry point\n│   │   ├── config.py          # Pydantic config models\n│   │   ├── convert.py         # Model conversion\n│   │   ├── validate.py        # Numerical validation\n│   │   ├── benchmark.py       # Performance measurement\n│   │   ├── optimize.py        # ONNX optimization\n│   │   ├── profile.py         # Model profiling\n│   │   ├── registry.py        # Model registry\n│   │   └── logging.py         # Structured logging (Rich / JSON)\n│   └── tests/                 # pytest test suite\n├── rust_runtime/              # Rust inference runtimes\n│   ├── crates/\n│   │   ├── runner_core/       # Shared Runner trait + tracing\n│   │   ├── runner_tch/        # LibTorch backend\n│   │   ├── runner_tract/      # tract (ONNX) backend\n│   │   └── runner_tensorrt/   # TensorRT backend\n│   └── examples/\n│       ├── image_server/      # Multi-model REST API with batching\n│       ├── denoiser_cli/      # Image denoising CLI\n│       └── wasm_frontend/     # Browser inference demo\n├── tools/                     # Standalone scripts\n├── benchmarks/                # Benchmark infrastructure\n├── examples/                  # User-facing examples\n│   └── example_unet/         # Complete UNet example\n├── docs/                      # Architecture docs\n└── .github/workflows/         # CI/CD + PyPI auto-deploy\n```\n\n---\n\n## 🧪 Testing\n\n```bash\n# Python tests\npytest python_client/tests/ -v --cov=oxidizedvision\n\n# Rust tests\ncargo test --workspace\n```\n\n### Pre-commit Hooks\n\n```bash\npip install pre-commit\npre-commit install\npre-commit run --all-files\n```\n\n---\n\n## 📦 Publishing to PyPI\n\nReleases are automatically published to PyPI when a GitHub Release is created with a `v*` tag (e.g., `v1.0.2`). See [`.github/workflows/publish.yml`](.github/workflows/publish.yml) for details.\n\nTo publish manually:\n\n```bash\npip install build twine\npython -m build\ntwine upload dist/*\n```\n\n---\n\n## 🤝 Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, testing instructions, and PR guidelines.\n\n---\n\n## 📄 License\n\nMIT License — see [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonepunchmonk%2Foxidized-vision","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonepunchmonk%2Foxidized-vision","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonepunchmonk%2Foxidized-vision/lists"}