Skip to content

fallback dtype for quantization layer filter - #1629

Open
dxqb wants to merge 1 commit into
Nerogar:masterfrom
dxqb:quantization-fallback-dtype
Open

fallback dtype for quantization layer filter#1629
dxqb wants to merge 1 commit into
Nerogar:masterfrom
dxqb:quantization-fallback-dtype

Conversation

@dxqb

@dxqb dxqb commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Previously, layers excluded by the quantization layer filter were silently cast to train_dtype instead of a user-chosen dtype. Add QuantizationConfig.fallback_dtype (default bfloat16), which can itself be a quantized type (fp8/int8/w8a8/nf4) -

The purpose is models like Qwen and Z-Image that don't quantize well over many layers to int8 - but their attn and mlp layers still do. Selecting that filter caused the remaining layers to be loaded in bf16 which wastes vram because they still perform well in float8.

Test plan

  • pre-commit run --all-files passes
  • Launched the affected UI or script and exercised the change
  • Tested with at least one real preset / config when relevant (note which: Qwen)

AI assistance

  • AI-assisted — I have read every line in this diff and can defend each change

…tion layer filter

Previously, layers excluded by the quantization layer filter were silently cast to
train_dtype instead of a user-chosen dtype. Add QuantizationConfig.fallback_dtype
(default bfloat16), which can itself be a quantized type (fp8/int8/w8a8/nf4) -
replace_linear_with_quantized_layers now quantizes filtered-out layers with the
fallback dtype's linear class instead of just skipping them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dxqb dxqb added the preview merged in the preview branch label Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview merged in the preview branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant