自动1111-Webui自动化
Python自动脚本以自动化自动1111/稳定 – 扩散 – Webui,以便在CSV的帮助下简化任务以一口气生成数千张图像。
步骤1-克隆:
- 对于https:
git clone https://git*hub*.c*om/AUTOMATIC1111/stable-diffusion-webui.git
- 对于SSH:
git clone git@github.com:AUTOMATIC1111/stable-diffusion-webui.git
步骤2-安装和运行:
按照读书中提供的setps安装和运行自动1111-稳定扩散webUI
注意1:成功安装后,使用API标志运行WebUI,如下: –
bash webui.sh --api
注2:成功运行WebUI后,请记下WebUI正在运行的URL。例如
Running on local URL: http://127.***0.0.1:7860
重要的是:不要使用SD-Webui运行的终端关闭或退出
步骤3-克隆此仓库(在另一个终端中)
- 对于https:
git clone https://gith*u*b*.com/ayushr6/sd-webui-automation.git
- 对于SSH:
git clone git@github.com:ayushr6/sd-webui-automation.git
步骤4-安装所需库
- CD SD-Webui-Automation
跑步:
pip install -r requirements.txt
步骤5-设置和运行脚本
要列出您的所有可用模型,请运行以下命令:
python generate_images.py print_available_models
您可以通过两种方式生成图像:
1。使用两个CSV文件:
- 其中一个包含演员,物品,动物等的唯一名称。
- 第二,其中包含提示,其中包含特殊字符,可以从初始CSV中替换为角色,项目,动物等的名称。
注意: – 第二个CSV还必须包含以下参数,替换_with,model_name,sampling_method,sampling_steps,cfg_scale和batch_count。
例如
first - tiny cute #### toy, soft smooth lighting, soft pastel colors, 3d blender render second - tiger or camel or any other animal name prompt = tiny cute tiger toy, soft smooth lighting, soft pastel colors, 3d blender render
这是这样,我们可以使用两个CSV为角色,动物等列表生成图像,并为每个关键字使用不同的提示。
跑步:
对于webui:
python generate_images.py generate_images_from_two_csv --input_csv \"input/animals.csv\" --prompt_csv \"input/animals_prompts.csv\" --headless False --output_dir \"output/animals\"
对于API:
python generate_images.py generate_images_from_two_csv --input_csv \"input/animals.csv\" --prompt_csv \"input/animals_prompts.csv\" --use api --output_dir \"output/animals\"
参数
Parameter | Definition ------------------------- | ----------------------------------------------------- `--input_csv` | `path` to `input_csv` `--prompt_csv` | `path` to `prompt_csv` `--webui_url` | `url` at which `automatic1111-webui` is running `--model` | sd model name (e.g. sd-v1-4) `--output_dir` | path to output_dir `--sampling_method` | sampling method name (e.g. Eular a, DDIM, etc.) `--sampling_steps` | sampling steps (1 - 150) `--batch_count` | number of images in one batch (1 - 100) `--cfg_scale` | cfg scale (1 - 30) `--use` | accepted values (webui/api) `--headless` | run webui in headless mode? (True/False) `--add_on` | overwrite existing content or not (`True` / `False`)
2。使用一个CSV文件:
- 该文件包含提示,尊重我们需要生成图像。
注意: – 此CSV还必须包含以下参数,replace_with,model_name,sampling_method,sampling_steps,cfg_scale和batch_count。
例如
prompt - tiny cute tiger toy, soft smooth lighting, soft pastel colors, 3d blender render
这是这样,我们可以使用两个CSV为角色,动物等列表生成图像,并为每个关键字使用不同的提示。
跑步:
对于webui:
python generate_images.py generate_images_from_single_csv --prompt_csv \"input/famous_structures.csv\" --headless False --output_dir \"output/famous_structures\"
对于API:
python generate_images.py generate_images_from_single_csv --prompt_csv \"input/famous_structures.csv\" --use api --output_dir \"output/famous_structures\"
参数
Parameter | Definition ------------------------- | ----------------------------------------------------- `--prompt_csv` | `path` to `prompt_csv` `--webui_url` | `url` at which `automatic1111-webui` is running `--model` | sd model name (e.g. sd-v1-4) `--output_dir` | path to output_dir `--sampling_method` | sampling method name (e.g. Eular a, DDIM, etc.) `--sampling_steps` | sampling steps (1 - 150) `--batch_count` | number of images in one batch (1 - 100) `--cfg_scale` | cfg scale (1 - 30) `--use` | accepted values (webui/api) `--headless` | run webui in headless mode? (True/False) `--add_on` | overwrite existing content or not (`True` / `False`)
CFG量表:一个控制生成图像与文本提示和/或输入图像的参数。较高的CFG比例值会导致输出图像更符合输入提示或图像,但以质量为代价。相反,较低的CFG量表值会产生更好的图像,这可能与原始提示或图像不同。
采样方法/采样器:采样器用于告诉AI如何从初始噪声开始生成视觉模式。 Novelai支持多种抽样方法:DPM ++ 2M,Euler Ancestral,Euler,DPM2,DPM ++ 2S祖先,DPM ++ SDE,DPM FAST和DDIM。 (注意:请参阅WebUI以查看所有采样器的列表)
采样步骤:采样步骤是稳定扩散以根据文本提示从随机噪声到可识别图像的迭代次数。
