白嫖Tesla T4 GPU玩转Stable Diffusion Webui

想要玩stable diffusion,算力不可少,白嫖google colab Tesla T4 GPU 玩转Stable Diffusion Webui

1、google colab上安装stable diffusion webui

https://colab.research.google.com/drive/1qL5eD2VESnop8mrbFcHzMmfzqzmRMMF4?usp=sharing

  • 在google colab中新建Stable Diffusion Webui googlecolab.ipynb文件

  • clone stable diffusion webui项目

!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
%cd "/content/stable-diffusion-webui"
  • 创建虚拟环境,并进入虚拟环境
!pip install virtualenv
!virtualenv venv
!source venv/bin/activate
  • 安装需要的环境
!pip install -r requirements_versions.txt
!pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchtext==0.14.1 torchaudio==0.13.1 torchdata==0.5.1 --extra-index-url https://download.pytorch.org/whl/cu117
  • 运行,不要忘记在代码执行程程序更改运行时类型gpu

!python launch.py --gradio-queue --share

最后会生成一个public link,点击链接打开即可

2、关于模型及下载
  • Civitai提供了很多模型,可以看看
– 可以在 Hugging Face 搜索模型的下载地址(主要是这个提供下载地址,可以更方便的在google colab中执行)
!git clone https://huggingface.co/luxluna/cuteGirlMix4_v10/resolve/main/cuteGirlMix4_v10.safetensors /content/stable-diffusion-webui/models/Stable-diffusion/cuteGirlMix4_v10.safetensors
– 也可以挂载Google 云盘,通过Google云盘上传模型
from google.colab import drive
drive.mount("/content/gdrive")

%mv /content/gdrive/MyDrive/ColabNotebooks/cuteGirlMix4_v10.safetensors /content/stable-diffusion-webui/models/Stable-diffusion/
3、关于google colab中命令的使用

%: 目录操作

!: 执行操作

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
青葱年少的头像青葱年少普通用户
上一篇 2023年12月27日
下一篇 2023年12月27日

相关推荐