跳到主要内容

入门指南

文生图
# python examples/example_txt2img.py --checkpoint_path <your model path> --prompt <your prompt> --output_path <result saved path>
python examples/example_txt2img.py --checkpoint_path models/Stable-diffusion/v1-5-pruned-emaonly.ckpt --prompt "A photo of an astronaut riding a horse on mars." --output_path outputs
图生图
# python examples/example_img2img.py --checkpoint_path <your model path> --image_path <your initial image path> --prompt <your prompt> --output_path <result saved path>
python examples/example_img2img.py --checkpoint_path models/Stable-diffusion/v1-5-pruned-emaonly.ckpt --image_path data/person.jpg --prompt "a pretty girl" --output_path outputs
边缘控制
# python examples/controlnets/example_canny2img.py --checkpoint_path <your model path> --canny_controlnet_path <your canny controlnet model path> --image_path <your image path> --prompt <your prompt> --output_path <result saved path>
python examples/controlnets/example_canny2img.py --checkpoint_path models/Stable-diffusion/v1-5-pruned-emaonly.ckpt --canny_controlnet_path models/controlnet/canny_v11 --image_path data/person.jpg --prompt "a pretty girl" --output_path outputs

更多的 controlnets 请移步 examples/controlnets 文件夹

LoRA 生图
# python examples/example_lora2img.py --checkpoint_path <your model path> --lora_path <your lora model path> --prompt <your prompt> --output_path <result saved path>
python examples/example_lora2img.py --checkpoint_path models/Stable-diffusion/v1-5-pruned-emaonly.ckpt --lora_path models/lora/moore_threads_lora.safetensors --prompt "a pretty girl" --output_path outputs
Text Inversion 生图
# python examples/example_textinversion2img.py --checkpoint_path <your model path> --text_inversion_path <your text inversion model path> --prompt <your prompt> --negative_prompt <your negative text inversion trigger word> --output_path <result saved path>
python examples/example_textinversion2img.py --checkpoint_path models/Stable-diffusion/v1-5-pruned-emaonly.ckpt --text_inversion_path models/text_embeddings/negative/moore_threads_easy_negative.safetensors --prompt "a pretty girl" --negative_prompt "moore_threads_easy_negative" --output_path outputs
图生文反推词
# python examples/example_tagger.py --checkpoint_path <your model path> --image_path <your image path>
python examples/example_tagger.py --checkpoint_path models/tools/deepbooru/model-resnet_custom_v3.pt --image_path data/person.jpg

超分
# python examples/example_super_resolution.py --checkpoint_path <your model path> --image_path <your image path> --output_path <result saved path>
python examples/example_super_resolution.py --checkpoint_path models/tools/realesrgan/RealESRGAN_x4plus.pth --image_path data/person.jpg --output_path outputs
中英翻译
# python examples/example_translator.py --checkpoint_path <your model path> --chinese_text <your Chinese text>
python examples/example_translator.py --checkpoint_path models/tools/zh2en --chinese_text "一个漂亮的小姑娘"