赞
踩
v1版本: 确保你至少有12G显存
git:
git clone https://github.com/CompVis/stable-diffusion.git
进入到你下载的路径
- conda env create -f environment.yaml
- conda activate ldm
-
两个文件随便下载一个就可以。重命名为model.ckpt,保存到\stable-diffusion\models\ldm\stable-diffusion-v1 目录下面
运行:
python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse
提示:
Traceback (most recent call last):
File "scripts/txt2img.py", line 22, in <module>
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
File "C:\Users\x\.conda\envs\ldm\lib\site-packages\diffusers\__init__.py", line 27, in <module>
from .pipelines import OnnxRuntimeModel
File "C:\Users\x\.conda\envs\ldm\lib\site-packages\diffusers\pipelines\__init__.py", line 18, in <module>
from .dance_diffusion import DanceDiffusionPipeline
File "C:\Users\x\.conda\envs\ldm\lib\site-packages\diffusers\pipelines\dance_diffusion\__init__.py", line 1, in <module>
from .pipeline_dance_diffusion import DanceDiffusionPipeline
File "C:\Users\x\.conda\envs\ldm\lib\site-packages\diffusers\pipelines\dance_diffusion\pipeline_dance_diffusion.py", line 21, in <module>
from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline
File "C:\Users\x\.conda\envs\ldm\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 64, in <module>
from transformers.utils import SAFE_WEIGHTS_NAME as TRANSFORMERS_SAFE_WEIGHTS_NAME
ImportError: cannot import name 'SAFE_WEIGHTS_NAME' from 'transformers.utils' (C:\Users\x\.conda\envs\ldm\lib\site-packages\transformers\utils\__init__.py)
这个确实很坑,默认里diffusers版本太高
解决方法:
conda list 查看diffusers版本,为0.14.0.
将这个删掉,
pip uninstall diffusers
重新安装0.12.1版本
pip install diffusers==0.12.1
或者在创建环境时直接修改 environments.yaml, "diffusers" --> "diffusers==0.12.1"
如果提示:TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
网络问题,多试几次就好。
如果提示RuntimeError: CUDA out of memory.,加个参数 --n_samples 1
---------------------------------
模型下载地址:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。