`register_to_config` mislabels positional `__init__` args as `_use_default_values`, so `from_config` round trips silently revert them to defaults
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- python
- Ambito
- developer-experience
Direzione di ricerca
Inizia in src/diffusers/configuration_utils.py intorno a inner_init alle righe 725-726 ed esamina extract_init_dict intorno alle righe 499-501. Esegui la riproduzione e aggiungi la copertura di regressione in tests/others/test_config.py. Il lavoro è completato quando sia gli argomenti posizionali sia quelli del costruttore con nome preservano i loro valori espliciti attraverso i round trip di from_config.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
@register_to_config computes _use_default_values as set(new_kwargs) - set(init_kwargs), but init_kwargs only contains keyword arguments (src/diffusers/configuration_utils.py:725-726). Any constructor argument passed positionally is mislabeled as "used default value", and extract_init_dict then strips it on every from_config round trip (configuration_utils.py:500-501).
- Expected: per the comment at
configuration_utils.py:499("Skip keys that were not present in the original config, so default__init__values were used") and the design intent in https://github.com/huggingface/diffusers/pull/3929#issuecomment-1618919655,_use_default_valuesshould only contain parameters the caller did not provide — positional and keyword calls should round-trip identically. - Actual: the config displays the explicitly-set value, but
from_config(obj.config)(the documented scheduler-swap pattern) silently reverts it to the class default. Affects everyConfigMixinsubclass.
I'd be happy to open a PR: exclude positionally-bound parameter names from the _use_default_values computation in inner_init (a two-line change), plus a regression test in tests/others/test_config.py — once a maintainer acks, per the AI-assisted contributions guidelines.
Reproduction
from diffusers import DDIMScheduler, EulerDiscreteScheduler
s = DDIMScheduler(500) # positional, explicit non-default value
print(s.config.num_train_timesteps) # 500
print("num_train_timesteps" in s.config["_use_default_values"]) # True <-- mislabeled
print(DDIMScheduler.from_config(s.config).config.num_train_timesteps) # 1000, expected 500
print(EulerDiscreteScheduler.from_config(s.config).config.num_train_timesteps) # 1000, expected 500
k = DDIMScheduler(num_train_timesteps=500) # keyword control group
print(DDIMScheduler.from_config(k.config).config.num_train_timesteps) # 500, correct
Logs
(no traceback — the failure mode is a silently wrong value)
System Info
- 🤗 Diffusers version: 0.40.0.dev0 (
main@ 614ae4b) - Platform: macOS-26.5.2-arm64-arm-64bit-Mach-O
- Python version: 3.13.3
- PyTorch version (GPU?): 2.13.0 (False)
- Huggingface_hub version: 1.27.0
- Transformers version: 5.15.0
- Safetensors version: 0.8.0
- Using GPU in script?: No
Who can help?
No response
Disclosure: this report was prepared with AI assistance; I reproduced the issue locally and reviewed every claim myself.
- Lingua principale
- Python
- Stelle
- 34.6k
- Fork
- 7.3k
- Merge medio
- 3g 16h
- PR unite (30g)
- 74
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di huggingface/diffusers
-
bug needs-env-info pipelines
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
huggingface/diffusers#14794 ·
-
bug needs-code-example needs-env-info pipelines
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
huggingface/diffusers#14780 · 1 commento ·
-
bug pipelines
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/diffusers#14769 · 1 commento ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
huggingface/diffusers#14639 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
huggingface/diffusers#14616 ·
Tutte le issue di huggingface/diffusers
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100