EDMDPMSolverMultistepScheduler and CosineDPMSolverMultistepScheduler raise UnboundLocalError for an unknown sigma_schedule

Aperta Adatta ai principianti
#15,436 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, pytorch

Direzione di ricerca

Leggi i costruttori di EDMDPMSolverMultistepScheduler e CosineDPMSolverMultistepScheduler, poi confronta la convalida di sigma_schedule con quella di EDMEulerScheduler. Aggiungi test per un valore non supportato come "Karras" e conferma che entrambi i costruttori sollevano ValueError con un messaggio utile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

EDMDPMSolverMultistepScheduler and CosineDPMSolverMultistepScheduler don't check sigma_schedule. Any value other than "karras" or "exponential" (a typo or a capitalised "Karras") skips both branches in __init__, and the constructor fails with an UnboundLocalError about sigmas instead of saying which argument is wrong. EDMEulerScheduler, which takes the same argument, already raises a ValueError for this.

I found this while reading the scheduler code, not from a failing run. I'd like to send a small PR that adds the same check to both schedulers, with tests.

Reproduction
from diffusers import CosineDPMSolverMultistepScheduler, EDMDPMSolverMultistepScheduler, EDMEulerScheduler

for cls in (EDMEulerScheduler, EDMDPMSolverMultistepScheduler, CosineDPMSolverMultistepScheduler):
    try:
        cls(sigma_schedule="Karras")
    except Exception as e:
        print(f"{cls.__name__}: {type(e).__name__}: {e}")
Logs
EDMEulerScheduler: ValueError: Wrong value for provided for `sigma_schedule='Karras'`.`
EDMDPMSolverMultistepScheduler: UnboundLocalError: cannot access local variable 'sigmas' where it is not associated with a value
CosineDPMSolverMultistepScheduler: UnboundLocalError: cannot access local variable 'sigmas' where it is not associated with a value
System Info
  • diffusers 0.44.0.dev0 (main at 08d5de30e)
  • Python 3.12.15, Linux x86_64
  • torch 2.15.0+cpu
Who can help?

@yiyixuxu

Lingua principale
Python
Stelle
35k
Fork
7.5k
Merge medio
2g 22h
PR unite (30g)
58

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di huggingface/diffusers

Tutte le issue di huggingface/diffusers

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.