DDIM官方代码调试

ddim官方源码分析

官方源码 ddim

  1. β t ∈ ( 0 , 1 ) \beta_t \in(0,1) βt(0,1) 的计算方式,有好几个种,源码中给出"linear",“const”,“jsd”,“sigmoid”,取值范围在(0,1),随着time_step逐步递增, 这是决定 产生Noise的分布参数,影响很大。
    也就是产生noise的参数是从 β t \beta_t βt中随机选出来的。

  2. 计算 α t {\alpha}_{t} αt α ˉ t \bar{\alpha}_{t} αˉt,这两个要搞清楚,后面的计算公式就不迷糊了
    α t = 1 − β t \alpha_t=1-\beta_t αt=1βt
    α ˉ t = α 1 . . . α t \bar{\alpha}_t= \alpha_1...\alpha_t αˉt=α1...αt 相乘

  3. 训练和DDPM保持不变

  4. 采样(推理)的公式变了,原来需要1000 steps,现在50个step就可以了,也就是中间可以跳过去。

  5. 对比了官网的代码,参数的命名很迷糊,目前我没有想到特别好的方案,反正一堆参数进去,要对原理完全理解,再去找代码确认理解是否到位。

vscode

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "test",
            "type": "python",
            "request": "launch",
            "program": "main.py",
            "console": "integratedTerminal",
            "justMyCode": true,
            "args": [
                "--config",
                "cifar10.yml",
                "--exp",
                "output/cifar10",
                "--doc",
                "ddim",
                "--sample",
                "--sequence",
                "--timesteps",
                "50",
                "--eta",
                "0",
                "--ni",
            ]
        },
        {
            "name": "main",
            "type": "python",
            "request": "launch",
            "program": "main.py",
            "console": "integratedTerminal",
            "justMyCode": true,
            "args": [
                "--config",
                "cifar10.yml",
                "--exp",
                "output/cifar10",
                "--doc",
                "ddim",
                "--ni",
            ]
        }
    ]
}

你可能感兴趣的:(stable,diffusion,人工智能,DDIM)