Skip to content

Mock quantization backends (optimum, torchao, gguf) for diffusers docs - #806

Merged
mishig25 merged 1 commit into
mainfrom
diffusers-quant-mocks
Jul 7, 2026
Merged

Mock quantization backends (optimum, torchao, gguf) for diffusers docs#806
mishig25 merged 1 commit into
mainfrom
diffusers-quant-mocks

Conversation

@mishig25

@mishig25 mishig25 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #805: the diffusers main doc build got past sentencepiece and then failed with KeyError: 'optimum_quanto' on api/quantization.md (https://github.com/huggingface/diffusers/actions/runs/28853508918). Two things:

  1. The page needs the quantization backends importable under DIFFUSERS_SLOW_IMPORT=yes (which the shared workflows set globally) — this adds optimum, torchao, and gguf as mocks, so autodoc documents the real QuantoConfig/TorchAoConfig/GGUF classes instead of dummies.
  2. The KeyError itself is a latent diffusers bug the container had been masking: dummy_optimum_quanto_objects.py declares backend "optimum_quanto" but BACKENDS_MAPPING only has the key "quanto", so requires_backends crashes instead of raising the intended "requires optimum-quanto" ImportError. Worth a one-line fix in diffusers regardless (cc'd on [fix] missing doc-builder imports diffusers#14134).

Validated: full diffusers docs (363 pages from current main) build in a fresh venv with only doc-builder + registry deps + diffusers --no-deps, with DIFFUSERS_SLOW_IMPORT=yes — the exact CI conditions (my earlier validations missed that env var; the local harness now sets it).

🤖 Generated with Claude Code

With DIFFUSERS_SLOW_IMPORT=yes (which the shared workflows set), the
quantization docs need the quanto/torchao/gguf backends importable.
Mocking optimum also sidesteps a diffusers bug in the unavailable path:
dummy_optimum_quanto_objects uses backend name "optimum_quanto" while
BACKENDS_MAPPING only has "quanto", so requires_backends raises
KeyError instead of the intended ImportError.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mishig25
mishig25 merged commit 0f47843 into main Jul 7, 2026
4 checks passed
@mishig25
mishig25 deleted the diffusers-quant-mocks branch July 7, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant