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日 13時間
- マージ済み PR(30日)
- 58
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
huggingface/diffusers のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
huggingface/diffusers#15170 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
huggingface/diffusers#15163 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Clarify set_adapters() adapter_weights documentation and type hints対応中かも @gorkadabo1 が 4 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
huggingface/diffusers#15146 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
`encode_video` truncates a fractional `fps`, so the video runs longer than its audio対応中かも @guptaishaan が 12 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
huggingface/diffusers#15104 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
VaeImageProcessor.denormalize() raises AttributeError for NumPy inputs対応中かも @tonycoder-hub が 23 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/diffusers#15011 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
huggingface/diffusers の issue をすべて見る
似ている issue
-
DBFS append mode silently overwrites existing files対応中かも @IlyaKhalafi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
fsspec/filesystem_spec#2429 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: Retrieval rerank fallback statistics stay zero after provider failure対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
volcengine/OpenViking#7014 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
fedora-copr/copr#4600 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ansys/pydpf-core#3620 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信