论文《潜在一致性模型》的官方存储库:Latent Consistency Models。
项目页面:https://latent-consistency-models.github.io
从Dreamshaper v7对Stable-Diffusion v1-5的微调版本中蒸馏得到,仅通过4,000次训练迭代(约32个A100 GPU小时)完成。

通过将无分类器引导融入模型输入,LCM能在极短的推理时间内生成高质量图像。我们在768x768分辨率设置下比较推理时间,CFG尺度w=8,批量大小=4,使用A800 GPU。

您可以在以下直接体验潜在线性模型: Hugging Face Spaces
要自己运行该模型,可以利用🚀 Diffusers库:
pip install --upgrade diffusers # make sure to use at least diffusers >= 0.22
pip install transformers acceleratefrom diffusers import DiffusionPipeline
import torch
pipe = DiffusionPipeline.from_pretrained("SimianLuo/LCM_Dreamshaper_v7")
# To save GPU memory, torch.float16 can be used, but it may compromise image quality.
pipe.to(torch_device="cuda", torch_dtype=torch.float32)
prompt = "Self-portrait oil painting, a beautiful cyborg with golden hair, 8k"
# Can be set to 1~50 steps. LCM support fast inference even <= 4 steps. Recommend: 1~8 steps.
num_inference_steps = 4
images = pipe(prompt=prompt, num_inference_steps=num_inference_steps, guidance_scale=8.0, lcm_origin_steps=50, output_type="pil").images如需更多信息,请查阅官方文档: 👉 https://huggingface.co/docs/diffusers/api/pipelines/latent_consistency_models#latent-consistency-models
pip install diffusers transformers acceleratefrom diffusers import DiffusionPipeline
import torch
pipe = DiffusionPipeline.from_pretrained("SimianLuo/LCM_Dreamshaper_v7", custom_pipeline="latent_consistency_txt2img", custom_revision="main", revision="fb9c5d")
# To save GPU memory, torch.float16 can be used, but it may compromise image quality.
pipe.to(torch_device="cuda", torch_dtype=torch.float32)
prompt = "Self-portrait oil painting, a beautiful cyborg with golden hair, 8k"
# Can be set to 1~50 steps. LCM support fast inference even <= 4 steps. Recommend: 1~8 steps.
num_inference_steps = 4
images = pipe(prompt=prompt, num_inference_steps=num_inference_steps, guidance_scale=8.0, output_type="pil").images@misc{luo2023latent,
title={Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference},
author={Simian Luo and Yiqin Tan and Longbo Huang and Jian Li and Hang Zhao},
year={2023},
eprint={2310.04378},
archivePrefix={arXiv},
primaryClass={cs.CV}
}当然,我很乐意帮助您翻译文本。请提供您希望翻译成中文的英文或其他语言的文本内容,我将确保其转换为通俗、专业、优雅且流畅的中文表达,并遵循Markdown格式。请注意,只需提供文本内容即可,不需要额外说明。