Registry / ai-ml / diffq-fixed

diffq-fixed

JSON →
library0.2.4pypypi✓ verified 85d ago

A differentiable quantization framework for PyTorch, fixed for compatibility with Python 3.11 and newer. This library provides differentiable quantization-aware training with custom quantizers and gradient approximations. Version 0.2.4 is current; no regular release cadence.

pip install diffq-fixed
INSTALL
IMPORT
SIG · DIFFQ-FIXED
D
diffq-fixed
ai-mlpythonv0.2.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DiffQuantizer
from diffq import DiffQuantizer
from diffq_fixed import DiffQuantizer
The package name is 'diffq-fixed' but import uses 'diffq'.

Initialize a DiffQuantizer wrapping a model, run a training step.

import torch from diffq import DiffQuantizer model = torch.nn.Linear(10, 5) quantizer = DiffQuantizer(model, n_bits=8) optimizer = torch.optim.SGD(model.parameters(), lr=0.01) x = torch.randn(4, 10) y = model(x) loss = y.sum() loss.backward() optimizer.step() print("Training step completed")
Debug
Known issues
gotchaImport path uses 'diffq' not 'diffq_fixed' even though the package is installed as 'diffq-fixed'.
fix
Use 'from diffq import DiffQuantizer' instead of 'from diffq_fixed import ...'
affects: all
breakingThis fork may not be compatible with the original diffq's serialization format (model checkpoints). Loading checkpoints saved with original diffq could fail.
fix
Re-train or re-quantize models using diffq-fixed from scratch, or check the release notes for any conversion tools.
affects: 0.2.4
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'diffq'
Installed the pip package 'diffq-fixed' but trying to import 'diffq_fixed' instead of 'diffq'.
fix
Change import to: from diffq import DiffQuantizer
RuntimeError: Quantizer not initialized
Calling forward on DiffQuantizer before initializing with the model (or calling .to_device()?).
fix
Ensure you pass the model to DiffQuantizer constructor: quantizer = DiffQuantizer(model, ...)
Upgrade
Version history
0.2.4latest on PyPI · released Nov 12, 2024
Audit
Dependencies
torchrequiredCore dependency; diffq builds on PyTorch tensors and autograd
Agent activity
19 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
diffq-fixed — pip install diffq-fixed · libregistry