Google Colab 上部署 Stable Diffusion Web UI

Posted 沧海一升

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Google Colab 上部署 Stable Diffusion Web UI相关的知识,希望对你有一定的参考价值。

什么是 Stable Diffusion Web UI Colab

Stable Diffusion 是 Stability AI 推出的一个基于深度学习技术文字生成图片AI模型。

Stable Diffusion Web UI 是一个强大好用的 Stable Diffusion Web 应用,你可以使用它来操作 Stable Diffusion 生成图片。

要运行 Stable Diffusion,你的电脑需要有一块强大的GPU和较大的运行内存。但如果你没有这样的硬件,你仍然可以充点小钱上 Google Colab 运行 Stable Diffusion Web UI Colab。

Stable Diffusion Web UI Colab 是一个可以在 Google Colab 上部署 Stable Diffusion Web UI 的 fork 项目。在它的 GitHub 仓库的 README 中已经准备好了不同模型的.ipynb文件,你只需要点击其中一个Open in Colab按钮,就可以在 Google Colab 上一键部署 Stable Diffusion Web UI Colab。

什么是 Google Colab

Colaboratory 简称 

可以在google colab上安装cupy吗?

【中文标题】可以在google colab上安装cupy吗?【英文标题】:Is it possible to install cupy on google colab? 【发布时间】:2018-08-14 13:27:19 【问题描述】:

我正在尝试在 google colab 上使用 GPU 运行 chainer。这需要安装cupy,但是我无法正确安装它,因为它在我的colab vm中找不到cuda环境。

错误信息如下...

收集cupy 下载 cupy-2.4.0.tar.gz (1.7MB) 100% |████████████████████████████████| 1.7MB 740kB/s 命令 python setup.py egg_info 的完整输出: cc1plus:警告:命令行选项“-Wstrict-prototypes”对 C/ObjC 有效,但对 C++ 无效 /tmp/tmpds3ikncy/a.cpp:1:10:致命错误:cublas_v2.h:没有这样的文件或目录 #包括 ^~~~~~~~~~~~~ 编译终止。 选项:'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False ****************************************************** * 警告:nvcc 不在路径中。 * 警告:请设置 nvcc 的路径。 ****************************************************** 包括目录:[] 库目录:[] 命令“x86_64-linux-gnu-gcc”失败,退出状态为 1 ****************************************************** * 警告:未找到包含文件:['cublas_v2.h'、'cuda.h'、'cuda_profiler_api.h'、'cuda_runtime.h'、'curand.h'、'cusparse.h'、'nvrtc .h', 'nvToolsExt.h'] * 警告:跳过安装 cuda 支持 *** 警告:检查您的 CFLAGS 环境变量 ****************************************************** 回溯(最近一次通话最后): 文件“”,第 1 行,在 文件“/tmp/pip-build-qu5red9h/cupy/setup.py”,第 32 行,在 ext_modules = cupy_setup_build.get_ext_modules() 文件“/tmp/pip-build-qu5red9h/cupy/cupy_setup_build.py”,第 385 行,在 get_ext_modules 扩展 = make_extensions(arg_options,编译器,use_cython) 文件“/tmp/pip-build-qu5red9h/cupy/cupy_setup_build.py”,第 275 行,在 make_extensions raise Exception('你的 CUDA 环境无效。' 例外:您的 CUDA 环境无效。请检查上述错误日志。

----------------------------------------

命令“python setup.py egg_info”失败,在/tmp/pip-build-qu5red9h/cupy/中出现错误代码1

【问题讨论】:

【参考方案1】:

编辑:Google Colaboratory 现在默认提供 Chainer、CuPy 和 iDeep。不再需要手动安装。


原答案

您可以使用***来避免自己在 Google Colab 上构建 CuPy。 Chainer 官方提供snippet 在 Google Colab 上安装 Chainer/CuPy。

!curl https://colab.chainer.org/install | sh -

【讨论】:

只是一个简短的说明,正如下面@Neerajan Saha 所暗示的那样 - 如果您在 Colab 的 GPU 上运行,则默认情况下您只会获得 CuPy(编辑 -> 笔记本设置 -> 硬件加速器 ->图形处理器)。如果没有,你会发现不先pip安装就无法导入cupy。【参考方案2】:

我们不需要在 Google colab 中手动安装 cupy。 在编辑下的笔记本设置中,我们可以选择 GPU。如果你已经安装了chainer,你可以通过这个来确认cupy的可用性:

chainer.print_runtime_info()

【讨论】:

以上是关于Google Colab 上部署 Stable Diffusion Web UI的主要内容,如果未能解决你的问题,请参考以下文章

Stable DiffusionStable Diffusion免安装在线部署教程

AI 生成二次元女孩,免费云端部署(仅需5分钟)

无需本地部署 在线使用Stable Diffusion Webui 使用共享模型

如何在 google colab 中使用 ngrok?

colab上配置mmdetection记录

colab上配置mmdetection记录