Bug Description
After PR #974 (fd92d96) bumped torchao from >=0.14.1,<0.16.0 to >=0.16.0,<0.17.0, model initialization fails with:
RuntimeError: Failed to import diffusers.models.autoencoders.autoencoder_oobleck because of the following error:
name 'logger' is not defined
Root Cause
torchao 0.16.0 removed the torchao.dtypes.uintx.uint4_layout module (which contained UInt4Tensor)
diffusers 0.36.0 (the currently resolved version, since diffusers is unpinned in pyproject.toml) imports this removed module at module level in diffusers/quantizers/torchao/torchao_quantizer.py:89
- The
ImportError handler at line 93 calls logger.warning(), but logger is not defined until line 126 — a bug in diffusers 0.36.0
- This causes a
NameError that propagates up and crashes VAE model loading
diffusers 0.37.0+ fixed this by:
- Moving
logger definition before the function call
- Adding a version gate:
if is_torchao_version(">", "0.15.0"): pass to skip the UInt4Tensor import entirely for torchao 0.16.0+
Reference: huggingface/diffusers#11018
Impact
- Gradio server starts but model initialization fails — users see the UI but cannot generate music
- The LLM handler initializes fine, but the DiT handler (which needs
AutoencoderOobleck from diffusers) crashes
Proposed Fix
Pin diffusers>=0.37.0 in pyproject.toml to ensure compatibility with torchao>=0.16.0.
diffusers was previously unpinned ("diffusers" with no version constraint), which allowed uv to resolve to 0.36.0 — a version incompatible with torchao 0.16.0.
Reproduction
# With torchao>=0.16.0 and diffusers<0.37.0 installed:
python -c "from diffusers.models import AutoencoderOobleck"
# → NameError: name 'logger' is not defined
Environment
- torch: 2.10.0+cu128
- torchao: 0.16.0
- diffusers: 0.36.0
- GPU: NVIDIA H200
Bug Description
After PR #974 (
fd92d96) bumpedtorchaofrom>=0.14.1,<0.16.0to>=0.16.0,<0.17.0, model initialization fails with:Root Cause
torchao0.16.0 removed thetorchao.dtypes.uintx.uint4_layoutmodule (which containedUInt4Tensor)diffusers0.36.0 (the currently resolved version, sincediffusersis unpinned inpyproject.toml) imports this removed module at module level indiffusers/quantizers/torchao/torchao_quantizer.py:89ImportErrorhandler at line 93 callslogger.warning(), butloggeris not defined until line 126 — a bug in diffusers 0.36.0NameErrorthat propagates up and crashes VAE model loadingdiffusers0.37.0+ fixed this by:loggerdefinition before the function callif is_torchao_version(">", "0.15.0"): passto skip theUInt4Tensorimport entirely for torchao 0.16.0+Reference: huggingface/diffusers#11018
Impact
AutoencoderOobleckfrom diffusers) crashesProposed Fix
Pin
diffusers>=0.37.0inpyproject.tomlto ensure compatibility withtorchao>=0.16.0.diffuserswas previously unpinned ("diffusers"with no version constraint), which alloweduvto resolve to 0.36.0 — a version incompatible withtorchao0.16.0.Reproduction
Environment