onecomp-runtime
Shared int4 inference runtime for OneCompression packed
checkpoints. OneCompression produces GPTQ/RTN-packed safetensors; this is the
consumer side — the int4 GEMM layers, GPTQ unpack/dequant helpers, backend
selection, and a generic diffusion loader that every per-model runtime builds a
thin adapter on top of.
pip install onecomp-runtime # import as onecomp_runtime
pip install onecomp-runtime[gemlite] # + GemLite int4 kernels
pip install onecomp-runtime[diffusion] # + diffusers (generic loader builds diffusers classes)
Why
The int4 leaf machinery was copy-pasted across the FLUX.2 / LTX-2.3 / FireRed /
Irodori runtimes — fused_int4_linear.py was byte-identical in three of them.
A fix to the kernel (K-padding, warmup buckets, dtype safety) had to be hand-
propagated to every repo. This package is the single source of truth.
Layout
onecomp_runtime/
layers/
fused_int4_linear.py # Triton dequant+GEMM (AutoGPTQ-v1, gs=32)
gemlite_int4_linear.py # GemLite kernel wrapper (fp16 I/O)
packed_linear.py # PackedRTNLinear, PackedEmbedding (RTN uint8-nibble)
packed_conv.py # int4 Conv1d / ConvTranspose1d (DAC-VAE codecs)
quant_utils.py # GPTQ + RTN unpack/dequant helpers
backend.py # resolve_backend / can_use_fused / build_{gemlite,fused,eager}
diffusion.py # load_int4_model(build_meta_model, ...) — generic GPTQ loader
Usage — a per-model runtime adapter
from onecomp_runtime.diffusion import load_int4_model
from diffusers import Flux2Transformer2DModel
def load_int4_transformer(path, **kw):
return load_int4_model(
path,
lambda cfg: Flux2Transformer2DModel.from_config(cfg),
label="flux2-klein-lite",
**kw,
)
The only per-model code is build_meta_model (construct the bare module from the
checkpoint's config_json) and an optional post_load(model) hook for buffer
fixups (e.g. FireRed/Qwen-Image RoPE tables that meta-init leaves uninitialised).
Backends
| backend | kernel | I/O dtype | when |
|---|---|---|---|
gemlite |
GemLite Triton int4 | fp16 only | large M (FLUX), if installed |
fused |
bundled Triton dequant+GEMM | fp16/bf16/fp32 | default; bf16-safe |
eager |
dequant once to nn.Linear |
any | groupsize≠32, actorder, odd shapes |
backend="auto" → gemlite if importable, else fused. bf16 is the safe default
for Qwen-Image / LTX (fp16 overflows to NaN); fp16 is only required on the
GemLite path.
Checkpoint contract
A single safetensors with metadata keys config_json, quant_layers_json
(per-layer manifest: name, wbits, groupsize, actorder, in_features,
out_features), and checkpoint_format (gptq v1 / gptq_v2). The RTN tier
(packed_linear, packed_conv) consumes the encoder/embedding/conv extras that
Irodori-style checkpoints add — those runtimes drive the layers directly rather
than through load_int4_model.
Metadata
Release files for onecomp-runtime 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| onecomp_runtime-0.1.0.tar.gz | 31.5 kB | Without provenance | Details for onecomp_runtime-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| onecomp_runtime-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for onecomp_runtime-0.1.0-py3-none-any.whl |
Total release size: 68.3 kB
Release files / onecomp_runtime-0.1.0.tar.gz
| Download URL | onecomp_runtime-0.1.0.tar.gz |
|---|---|
| Size | 31.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8fb4585dcdffe232bab79bb7c46379fb80ba154500029f8b86c09afdc3e5ad0
|
|
BLAKE2b-256 checksum How to use checksums |
fb9b018c70e41d496109b8c6d5ce397f751a1451b495cae5f5b1618a247fe308
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / onecomp_runtime-0.1.0-py3-none-any.whl
| Download URL | onecomp_runtime-0.1.0-py3-none-any.whl |
|---|---|
| Size | 36.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d4d11f40dcc77c0ef90ae022de64475e9f03d7504225b44c9b3b036a6b2e81dd
|
|
BLAKE2b-256 checksum How to use checksums |
e1b9ba8644f533f16d717a58705a52f0105f807877009c5fc03e00fab01109fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for onecomp-runtime 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.