EDMDPMSolverMultistepScheduler and CosineDPMSolverMultistepScheduler raise UnboundLocalError for an unknown sigma_schedule

未關閉 適合新手
#15,436 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
82/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python, pytorch

研究方向

閱讀 EDMDPMSolverMultistepScheduler 和 CosineDPMSolverMultistepScheduler 的建構子,接著將它們對 sigma_schedule 的驗證與 EDMEulerScheduler 進行比較。為 "Karras" 這類不支援的值新增測試,並確認兩個建構子都會引發 ValueError,且錯誤訊息有用。

由索引模型根據 Issue 內容生成。

描述

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

主要語言
Python
星號
35k
分支
7.5k
平均合併
2 天 22 小時
30 天內合併 PR
58

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

huggingface/diffusers 的其他 Issue

查看 huggingface/diffusers 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。