Stable Diffusion webui 源码调试(二)

Stable Diffusion webui 源码调试(二)

个人模型主页:LibLibai

stable-diffusion-webui 版本:v1.4.1

内容更新随机,看心情调试代码~

分析StableDiffusionProcessingTxt2Img类中的sample函数

Sampler

/work/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py

这个Sampler就是真正去执行生成 latent空间的图像了。

sample函数,接收了生图时需要的全部参数

可以看到初始latent图像就是 前面生成的随机图像x

最后就是self.launch_sampling函数的封装,进入到sample_euler_ancestral函数,生图,latent空间中的生图细节就在这个函数里面了。

这里我们用了euler采样器,换其他采样器同理。

这个函数返回x, 就是latent空间的图像,出去之后,调用decode部分的网络,就得到我们所看到的图像。

不执行数据增强的情况下,直接返回 latent空间的图像。

回到process_images_inner函数(/work/stable-diffusion-webui/modules/processing.py)

可以看到samples_ddim(latent空间的图像)经过decode_first_stage函数处理后,得到x,就是下图。

先整理到这里。

相关推荐
weiwei228446 天前
文生图模型Stable Diffusion使用详解
stable diffusion·文生图
Hello123网站6 天前
DreamStudio-Stable Diffusion官方绘画工具
stable diffusion·ai工具
如若1236 天前
CompVis Stable Diffusion 正确安装与运行指南
stable diffusion
全息数据12 天前
DDPM代码讲解【详细!!!】
深度学习·stable diffusion·多模态·ddpm
老鱼说AI21 天前
当自回归模型遇上扩散模型:下一代序列预测模型详解与Pytorch实现
人工智能·pytorch·深度学习·神经网络·语言模型·自然语言处理·stable diffusion
我希望的一路生花1 个月前
Nik Collection 6.2全新版Nik降噪锐化调色PS/LR插件
人工智能·计算机视觉·设计模式·stable diffusion·aigc
GetcharZp1 个月前
玩转AI绘画,你只差一个节点式“魔法”工具——ComfyUI 保姆级入门指南
人工智能·stable diffusion
Seeklike1 个月前
diffuxers学习--AutoPipeline
人工智能·python·stable diffusion·diffusers
游戏AI研究所1 个月前
ComfyUI 里的 Prompt 插值器(prompt interpolation / text encoder 插值方式)的含义和作用!
人工智能·游戏·机器学习·stable diffusion·prompt·aigc
迈火1 个月前
ComfyUI-3D-Pack:3D创作的AI神器
人工智能·gpt·3d·ai·stable diffusion·aigc·midjourney