参考:
http://www.bryh.cn/a/604194.html
import torch
from diffusers import PixArtAlphaPipeline
pipe = PixArtAlphaPipeline.from_pretrained("PixArt-alpha/PixArt-XL-2-1024-MS", torch_dtype=torch.float16)
pipe = pipe.to('cuda')
prompt = "A alpaca made of colorful building blocks, cyberpunk"
image = pipe(prompt, num_inference_steps=30).images[0]
image
image.save("./catcus.png") ##保存图片
noise_scheduler = pipe.scheduler
noise_scheduler
看到PixArtAlpha模型前向加噪声beta 是0.0001到0.02,是linear线性改变
beta_start、beta_end和beta_schedule 3个参数来控制噪声调度器的超参数beta。
beta_start为控制推理阶段开始的beta值
beta_end为控制beta的最终值
beta_schedule可以通过一个函数映射来为模