DeepGraphLearning / DeepGraphLearning/PerturbDiff
Question for DDIM sampling configuration
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 63
- 派生
- 10
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hi, thank you for releasing the PerturbDiff implementation. I noticed a possible mismatch between the DDIM sampling configuration and the training diffusion schedule.
The model is configured with a 1000-step diffusion process:
[configs/model/base.yaml](https://github.com/DeepGraphLearning/PerturbDiff/blob/main/configs/model/base.yaml#L34-L38):steps: 1000
However, the default sampling configuration uses:
[configs/rawdata_diffusion_sampling.yaml](https://github.com/DeepGraphLearning/PerturbDiff/blob/main/configs/rawdata_diffusion_sampling.yaml#L38-L42):start_time: 100
In [resolve_sampling_runner](https://github.com/DeepGraphLearning/PerturbDiff/blob/main/src/apps/sampling/sampling_generation_helpers.py#L23-L34), this value is passed directly to ddim_sample_loop as start_time. The DDIM loop then:
- Initializes the state from standard Gaussian noise:
img = noise if noise is not None else th.randn(*shape, device=device)
- Constructs consecutive timestep indices:
indices = list(range(start_time))[::-1]
Therefore, with the default configuration, sampling starts from pure Gaussian noise at timestep 99 and performs 100 consecutive updates:
99 -> 98 -> ... -> 1 -> 0
This behavior is implemented in [ddim_sample_loop_progressive](https://github.com/DeepGraphLearning/PerturbDiff/blob/main/src/models/diffusion/diffusion_sampling.py#L559-L590). Each DDIM update also uses alphas_cumprod_prev[t], so it specifically transitions from timestep t to the adjacent timestep t-1, rather than between respaced timesteps:
My concern is that, under the default 1000-step linear schedule, timestep 99 is not close to the terminal Gaussian distribution. The configured beta schedule gives approximately:
alpha_bar[99] = 0.897
sqrt(alpha_bar[99]) = 0.947
sqrt(1 - alpha_bar[99]) = 0.321
Therefore, the forward-process state at timestep 99 is approximately:
x_99 = 0.947 * x_0 + 0.321 * noise
In other words, the training distribution at timestep 99 still contains a strong contribution from the clean sample. The sampler instead initializes:
x_99 ~ Normal(0, I)
If the intended goal is accelerated DDIM sampling with 100 model evaluations, I would expect the sampler to select approximately 100 respaced timesteps spanning the full training horizon from 999 to 0, and to calculate each update using the previous selected timestep. The current implementation instead appears to treat start_time as both the desired number of sampling steps and the actual starting diffusion timestep.
Could you please explain the rationale for initializing pure Gaussian noise at timestep 99? Is this behavior intentional, or should the 100-step DDIM sampler use a respaced timestep sequence covering the full 1000-step training schedule?
Thank you for your time and clarification.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
比较 configs/model/base.yaml 和 configs/rawdata_diffusion_sampling.yaml,然后跟踪 resolve_sampling_runner 到 src/models/diffusion/diffusion_sampling.py。复现已配置的 timestep 序列,并检查 alphas_cumprod_prev 的使用方式。确认预期的开始时间语义,或指定、实现一个 respaced schedule 并由适当的测试覆盖,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- machine-learning
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100