在 64 位 Ubuntu 22.04 LTS 上安装并运行 Stable Diffusion

Ada*_*sen 6 python gpu

https://github.com/CompVis/stable-diffusion/

有人可以在 64 位 Ubuntu 22.04 LTS 上使用此功能吗?您能否分享有关如何使其工作的步骤,或者只是链接到已知的测试/工作指南?

Ada*_*sen 6

知道了。我会把它写下来以防它对其他人有帮助。这最初仅涵盖 CPU“采样”(生成图像),直到我开始 GPU 采样工作。采样应该完全离线运行。

使用 pip 安装

  1. pip install --upgrade diffusers transformers scipy torch
  2. sudo apt install git-lfs
  3. 克隆 git 存储库https://huggingface.co/runwayml/stable-diffusion-v1-5(您必须先登录或注册并接受其许可协议)

然后,您可以创建一个小型 Python 脚本(在上面克隆的 git 存储库的本地工作副本中)并运行它来尝试自己采样:

from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained('.')
prompt = "a photo of an astronaut riding a horse on mars"
image = pipe(prompt).images[0]  
image.save("astronaut_rides_horse.png")
Run Code Online (Sandbox Code Playgroud)

更简单更好的方法

https://github.com/invoke-ai/InvokeAI#installation

这也提供了一个非常好的 Web GUI。

板载GPU注释

我的 GPU 显示为Intel CometLake-S GT2 [UHD Graphics 630]fromlspci | grep VGAneofetchscreenfetch称之为Mesa Intel(R) UHD Graphics 630 (CML GT2). 不管怎样,我不知道如何使用这个 GPU 进行采样(或者是否可能)。