Quantizer configs are mutated in place, leaking modules_to_not_convert across loads
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 54/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
Start by reading _process_model_before_weight_loading in bnb_quantizer.py, torchao_quantizer.py, quanto_quantizer.py, and modelopt_quantizer.py, then trace how each quantizer handles modules_to_not_convert and modelopt_config["quant_cfg"]. Reproduce the shared-config mutation with the supplied BitsAndBytes example and check for tests covering repeated loads and PipelineQuantizationConfig. Done means repeated loads leave the shared config unchanged and do not accumulate entries in saved config.json.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
BitsAndBytes (4-bit and 8-bit), TorchAO, Quanto, and ModelOpt quantizers each alias a modules_to_not_convert-style list directly from self.quantization_config and then call .extend() on it, instead of copying it first:
- BitsAndBytes 4/8-bit:
bnb_quantizer.py(_process_model_before_weight_loading) - TorchAO:
torchao_quantizer.py(_process_model_before_weight_loading) - Quanto:
quanto_quantizer.py(_process_model_before_weight_loading) - ModelOpt:
modelopt_quantizer.py(_process_model_before_weight_loading), which also writes module entries intomodelopt_config["quant_cfg"]
Reusing the same quantization_config object across two from_pretrained calls leaks state between loads — keep_in_fp32_modules and CPU/disk-offloaded module names accumulate on the shared config object across calls, and in PipelineQuantizationConfig the same quant_kwargs list / quant_mapping object is shared across components (including transformers text encoders), so the leak isn't confined to one component. The accumulated list also gets written into config.json on save.
Reproduction
import torch
from diffusers import BitsAndBytesConfig
from diffusers.quantizers.bitsandbytes.bnb_quantizer import BnB8BitDiffusersQuantizer
skip_modules = ["proj_out"]
config = BitsAndBytesConfig(load_in_8bit=True, llm_int8_skip_modules=skip_modules)
model = torch.nn.Sequential(torch.nn.Linear(4, 4), torch.nn.Linear(4, 4))
for _ in range(2):
quantizer = BnB8BitDiffusersQuantizer(config)
quantizer._process_model_before_weight_loading(model, device_map=None, keep_in_fp32_modules=["norm_out"])
print(config.llm_int8_skip_modules)
# ['proj_out', 'norm_out', 'norm_out'] after two loads - should stay ['proj_out']
System Info
diffusers@main, commitaaf57d0- Python 3.12, Linux
Who can help?
(leaving blank — no specific quantization reviewer listed in the template's tag guide)
- 主要言語
- Python
- スター
- 34.8k
- フォーク
- 7.4k
- 平均マージ
- 2日 14時間
- マージ済み PR(30日)
- 59
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
huggingface/diffusers のほかの issue
-
Clarify set_adapters() adapter_weights documentation and type hints対応中かも @gorkadabo1 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
huggingface/diffusers#15146 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/diffusers#15125 ·
メンテナーはふだん 1 日以内に返信
-
`encode_video` truncates a fractional `fps`, so the video runs longer than its audio対応中かも @guptaishaan が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
huggingface/diffusers#15104 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
VaeImageProcessor.denormalize() raises AttributeError for NumPy inputs対応中かも @tonycoder-hub が 19 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/diffusers#15011 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`ModelMixin.from_pretrained` on a sharded checkpoint fails under `HF_HUB_OFFLINE=1` even when fully cached (`_get_checkpoint_shard_files` still calls `model_info`)対応中かも @Subodh-17 が 25 日前に担当しました。 オープンbug models
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
huggingface/diffusers#14952 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
huggingface/diffusers の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
namespace operations
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
EclipseFdn/open-vsx.org#15057 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
FinanceFlash/unvibecode#349 ·
-
Mission statement: why this is free, in the README, Why This Exists and the wiki Home対応中かも @ChiefGyk3D が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ChiefGyk3D/Clouds-Against-Humanity#348 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
vllm-project/vime#508 ·
メンテナーはふだん 4 日以内に返信