概述

稳定扩散我试着在我的电脑上运行它。
官方程序使用 Anaconda,但我尝试使用 pyenv-virtualenv 运行它。

方法

git clone https://github.com/CompVis/stable-diffusion
cd stable-diffusion
vi requirements.txt

在 requirements.txt 中,填写你从 environment.yaml 中的 pip 项复制的内容,并将其放在此处。

要求.txt
albumentations==0.4.3
diffusers
opencv-python==4.1.2.30
pudb==2019.2
invisible-watermark
imageio==2.9.0
imageio-ffmpeg==0.4.2
pytorch-lightning==1.4.2
omegaconf==2.1.1
test-tube>=0.7.5
streamlit>=0.73.1
einops==0.3.0
torch-fidelity==0.3.0
transformers==4.19.2
torchmetrics==0.6.0
kornia==0.6
-e git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers
-e git+https://github.com/openai/CLIP.git@main#egg=clip
-e .

重量文件 sd-v1-4.ckpthttps://huggingface.co/CompVis/stable-diffusion-v-1-4-original并把它放在这里。

pyenv install 3.8.5
pyenv virtualenv 3.8.5 ldm
pyenv local ldm

安装 PyTorch。在 Ubuntu 22.04 上,应使用 sudo apt install nvidia-cuda-toolkit 输入 CUDA。

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
pip install -r requirements.txt

我会做。

python scripts/txt2img.py --prompt "engineer" --plms --ckpt sd-v1-4.ckpt --n_samples 1

运行时间约为 50 秒。

参考网址

我使用以下 URL 作为参考。
https://zenn.dev/ettsu/articles/6a1e68cea8864b


原创声明:本文系作者授权爱码网发表,未经许可,不得转载;

原文地址:https://www.likecs.com/show-308624594.html

相关文章:

  • 2021-11-21
  • 2022-01-06
  • 2022-12-23
  • 2022-12-23
  • 2021-04-15
  • 2021-08-07
猜你喜欢
  • 2022-12-23
  • 2021-09-27
  • 2021-11-15
  • 2022-02-14
  • 2021-12-20
  • 2021-06-10
  • 2021-07-10
相关资源
相似解决方案