{"id":26896,"library":"diffq-fixed","title":"diffq-fixed","description":"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.","status":"active","version":"0.2.4","language":"python","source_language":"en","source_url":"https://github.com/JackismyShephard/diffq","tags":["differentiable quantization","pytorch","quantization-aware training"],"install":[{"cmd":"pip install diffq-fixed","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Core dependency; diffq builds on PyTorch tensors and autograd","package":"torch","optional":false}],"imports":[{"note":"The package name is 'diffq-fixed' but import uses 'diffq'.","wrong":"from diffq_fixed import DiffQuantizer","symbol":"DiffQuantizer","correct":"from diffq import DiffQuantizer"}],"quickstart":{"code":"import torch\nfrom diffq import DiffQuantizer\n\nmodel = torch.nn.Linear(10, 5)\nquantizer = DiffQuantizer(model, n_bits=8)\noptimizer = torch.optim.SGD(model.parameters(), lr=0.01)\n\nx = torch.randn(4, 10)\ny = model(x)\nloss = y.sum()\nloss.backward()\noptimizer.step()\nprint(\"Training step completed\")","lang":"python","description":"Initialize a DiffQuantizer wrapping a model, run a training step."},"warnings":[{"fix":"Use 'from diffq import DiffQuantizer' instead of 'from diffq_fixed import ...'","message":"Import path uses 'diffq' not 'diffq_fixed' even though the package is installed as 'diffq-fixed'.","severity":"gotcha","affected_versions":"all"},{"fix":"Re-train or re-quantize models using diffq-fixed from scratch, or check the release notes for any conversion tools.","message":"This fork may not be compatible with the original diffq's serialization format (model checkpoints). Loading checkpoints saved with original diffq could fail.","severity":"breaking","affected_versions":"0.2.4"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change import to: from diffq import DiffQuantizer","cause":"Installed the pip package 'diffq-fixed' but trying to import 'diffq_fixed' instead of 'diffq'.","error":"ModuleNotFoundError: No module named 'diffq'"},{"fix":"Ensure you pass the model to DiffQuantizer constructor: quantizer = DiffQuantizer(model, ...)","cause":"Calling forward on DiffQuantizer before initializing with the model (or calling .to_device()?).","error":"RuntimeError: Quantizer not initialized"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}