https://github.com/huggingface/diffusers/releases/tag/v0.29.0
https://huggingface.co/stabilityai/stable-diffusion-3-medium-diffusers
https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_3
实验过程:
-
安装依赖:
bashpip install -U diffusers pip install transformers pip install sentencepiece
-
在 huggingface 上申请 SD3 并创建 Token,然后在终端进行登录:
-
随后就可以使用 demo 进行推理,第一次下载模型较慢,以后每次调用可以直接加载模型进行推理:
需要注意的是,预训练模型会下载到 cache 文件夹下,如果想要更改位置,可以提前设置
HF_HOME
或HUGGINFACE_HUB_CACHE
环境变量 ^1^
实验结果:
a photo of an astronaut riding a horse on mars:
a photo of a Lamborghini racing on the track:
a photo of the night scenery of Chongqing:
a photo of the Great Wall:
A poster of Ferrari:
A wallpaper of NBA stars: