EulerDiscreteScheduler returns incorrect v-prediction targets for discrete timesteps

Đang mở Phù hợp với người mới
#15,461 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, pytorch
Lĩnh vực
machine-learning

Hướng nghiên cứu

Đọc EulerDiscreteScheduler.get_velocity và so sánh cách tra cứu timestep với DDIMScheduler.get_velocity. Chạy ví dụ tái hiện được cung cấp để xác nhận sự không khớp tại các timestep rời rạc 999 và 500. Hoàn tất khi cả hai scheduler trả về các mục tiêu vận tốc giống nhau với cùng betas và đầu vào.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Describe the bug

I found this while reading EulerDiscreteScheduler.get_velocity. It looks up each timestep's position in the descending schedule and uses that position to index alphas_cumprod. At timestep 999 the default schedule reads alphas_cumprod[0]. I plan to fix the lookup to use the discrete training timestep value.

Reproduction
import torch
from diffusers import DDIMScheduler, EulerDiscreteScheduler

config = {
    "beta_start": 0.00085,
    "beta_end": 0.012,
    "beta_schedule": "scaled_linear",
    "prediction_type": "v_prediction",
}
sample = torch.tensor([[1.0, -2.0], [0.5, 3.0]])
noise = torch.tensor([[0.25, 0.5], [-0.75, 1.0]])
timesteps = torch.tensor([999.0, 500.0])
actual = EulerDiscreteScheduler(**config).get_velocity(sample, noise, timesteps)
expected = DDIMScheduler(**config).get_velocity(sample, noise, timesteps.long())
print((actual - expected).abs().max().item())

I get 1.4713691473007202. Both schedulers have the same betas, so the velocity targets should agree.

Context

The SDXL T2I-Adapter training script uses this result as its loss target when the scheduler is configured for v_prediction. I reproduced the mismatch at the scheduler call on CPU with synthetic inputs.

System Info

Diffusers 0.44.0.dev0 at 08d5de3, Python 3.14.5, PyTorch 2.15.0+cpu, Linux x86_64. Single process on CPU.

Ngôn ngữ chính
Python
Star
35k
Fork
7.5k
Merge trung bình
3 ngày 2 giờ
Pull request đã merge (30 ngày)
58

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của huggingface/diffusers

Tất cả issue của huggingface/diffusers

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.