Stable Diffusion Parameter

下面是在 Byzer 中使用 stable_diffusion 生成图片的一些参数。

启动参数

!byzerllm setup single;
!byzerllm setup "num_gpus=2";

run command as LLM.`` where 
action="infer"
and pretrainedModelType="custom/stable_diffusion"
and localModelDir="/home/byzerllm/models/stable-diffusion-v1-5"
and reconnect="false"
and udfName="sd_chat"
and modelTable="command";
参数含义默认值
localPathPrefix模型checkpoint,lora,emb等缓存路径在localModelDir目录下新建stable_diffusion_models目录
xformers开启xformers(需要pip install xformers)"true"
hf_tokenHugging face的token""
precision精度"fp16"
variant调用模型的类型"fp16"
checkpoint模型是否调用checkpoint"checkpoint"
select explode(from_json(llm_response_predict(sd_chat(llm_param(map(
"instruction", 'cat',
"generation.width", "512",
"generation.height", "512",
"generation.batch_count", "2",
"generation.batch_size", "2"
)))),'Array<struct<prompt: string, img64: string>>')) as nr from finalResult as jsonTable;

select nr.prompt, nr.img64 from jsonTable as result;

模型参数

参数含义默认值
Instructionprompt非空
generation.negative_prompt反向的prompt""
generation.sampler_name调度名(unpic, euler_a,euler,ddim,ddpm,deis,dpm2,dpm2-a,dpm++_2m,dpm++_2m_karras,heun,heun_karras,lms,pndm:w)euler_a
generation.sampling_steps生成的步骤数25
generation.batch_size一次生成几张1
generation.batch_count生成几次1
generation.cfg_scale随机或贴合程度值,值越小生成的图片离你的Tags描述的内容差距越大7.5
generation.seed随机种子-1
generation.width图片宽度768
generation.height图片高度768
generation.enable_hires开启高分辨率修复功能(和下面两个一组)false
generation.upscaler_mode放大算法(bilinear, bilinear-antialiased,bicubic,bicubic-antialiased,nearest,nearest-exact)bilinear
generation.scale_slider放大比例1.5
generation.enable_multidiff图片分割处理(减少显存销耗)(和下面3个一组)false
generation.views_batch_size分批处理规模4
generation.window_size切割大小,宽,高64
generation.stride步长16
generation.init_image初始化图片,基于这个图片处理(必须传输base64加密的图片) (和下面的一组)None
generation.strength重绘幅度: 图像模仿自由度,越高越自由发挥,越低和参考图像越接近,通常小于0.3基本就是加滤镜0.5

scheduler Link: https://blog.csdn.net/guochunyun/article/details/130362582

生成效果图

img.png

img.png

img.png

Logo

更多推荐