見出し画像

Stable Diffusion XL を Paperspaceで動かしてみる

PaperspaceのチュートリアルでStable Diffusion XL を Paperspaceで動かす手順について説明がありました(Stable Diffusion XL with Paperspace)ので、試しに実施してみます。

Paperspaceのチュートリアル

Notebookの起動

動かすためにはページ上の方の [Run on Gradient]ボタンを押せばよいようです。

実行ボタン
ボタンを押した後の画面

説明によると、FreeGPU(8GB)ではスペックが不足で、16GB以上必要だそうです。

[START MACHINE] を押すと、FreeGPUを起動しようとして、空きがないとメッセージが出ます。
そこでリンクURLで Free-GPU とある部分を、Free-P5000 と変更したら起動できました。こちらは16GBあるので大丈夫でしょう。
(元のリンクURL)
https://console.paperspace.com/github/gradient-ai/stable-diffusion-xl-demo?machine=Free-GPU&ref=blog.paperspace.com&_gl=1*1qnol8*_gcl_au*MTkzMDg4NTg2My4xNjg2Mzg2NjQx
(変更後のリンクURL)
https://console.paperspace.com/github/gradient-ai/stable-diffusion-xl-demo?machine=Free-P5000&ref=blog.paperspace.com&_gl=1*1qnol8*_gcl_au*MTkzMDg4NTg2My4xNjg2Mzg2NjQx

Notebook起動画面

セットアップ

Stable_Diffusion_XL_Demo.ipynb を開きます。

Stable_Diffusion_XL_Demo.ipynb
Stable_Diffusion_XL_Demo.ipynbクリック後

上から順番に実施していきます。

まず、access tokenを発行する必要があるようです。

Note that to get SD XL weights, you need to submit a quick form and set up a HuggingFace access token. Leaked weights seem to be available on reddit, but I have not used/tested them.

フォームにアクセスします。


Form入力欄

Organization: Independent Resercher
Nature of reserch:AI research focused on artistic image generation
Personal resercher link:facebook のリンクを記載
Other Comments:I have high expectations for the development of SDXL.

Form入力例


①access_tokenは、チュートリアルに記載してる文字列ではなく、自分のHuggingfaceアカウントで設定したトークンを指定しました。(以下はチュートリアルに記載しているもの)

access_token設定

②4行目、5行目は、チュートリアルと同じでした。

2ステップ目

事項結果にはエラーもありますが、一通り終わりまで進みました。

[Errno 2] No such file or directory: 'stable-diffusion-xl-demo'
/notebooks
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu113
Collecting git+https://github.com/huggingface/diffusers.git (from -r requirements.txt (line 12))
  Cloning https://github.com/huggingface/diffusers.git to /tmp/pip-req-build-297omac_
  Running command git clone --filter=blob:none --quiet https://github.com/huggingface/diffusers.git /tmp/pip-req-build-297omac_
  Resolved https://github.com/huggingface/diffusers.git to commit 2e53936c97d167713c9e97414160124861fa4b68
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting torch==2.0.1
  Downloading torch-2.0.1-cp39-cp39-manylinux1_x86_64.whl (619.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 619.9/619.9 MB 2.8 MB/s eta 0:00:0000:0100:01
Collecting python-dotenv
  Downloading python_dotenv-1.0.0-py3-none-any.whl (19 kB)
Collecting accelerate
  Downloading accelerate-0.21.0-py3-none-any.whl (244 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 244.2/244.2 kB 38.6 MB/s eta 0:00:00
Requirement already satisfied: transformers in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 5)) (4.21.3)
Collecting invisible-watermark
  Downloading invisible_watermark-0.2.0-py3-none-any.whl (1.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 54.3 MB/s eta 0:00:00
Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 7)) (1.23.4)
Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 8)) (1.4.1)
Requirement already satisfied: opencv-python>=4.1.0.25 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 9)) (4.6.0.66)
Collecting safetensors
  Downloading safetensors-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 43.7 MB/s eta 0:00:00
Collecting gradio==3.11.0
  Downloading gradio-3.11.0-py3-none-any.whl (11.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.6/11.6 MB 51.3 MB/s eta 0:00:0000:0100:01
Collecting nvidia-cublas-cu11==11.10.3.66
  Downloading nvidia_cublas_cu11-11.10.3.66-py3-none-manylinux1_x86_64.whl (317.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 317.1/317.1 MB 4.9 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: typing-extensions in /usr/local/lib/python3.9/dist-packages (from torch==2.0.1->-r requirements.txt (line 2)) (4.4.0)
Collecting nvidia-cuda-nvrtc-cu11==11.7.99
  Downloading nvidia_cuda_nvrtc_cu11-11.7.99-2-py3-none-manylinux1_x86_64.whl (21.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 21.0/21.0 MB 44.6 MB/s eta 0:00:0000:0100:01
Collecting nvidia-cusolver-cu11==11.4.0.1
  Downloading nvidia_cusolver_cu11-11.4.0.1-2-py3-none-manylinux1_x86_64.whl (102.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 102.6/102.6 MB 12.6 MB/s eta 0:00:0000:0100:01
Collecting nvidia-cuda-runtime-cu11==11.7.99
  Downloading nvidia_cuda_runtime_cu11-11.7.99-py3-none-manylinux1_x86_64.whl (849 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 849.3/849.3 kB 37.5 MB/s eta 0:00:00
Collecting sympy
  Downloading sympy-1.12-py3-none-any.whl (5.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 46.8 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: filelock in /usr/local/lib/python3.9/dist-packages (from torch==2.0.1->-r requirements.txt (line 2)) (3.9.0)
Collecting nvidia-cudnn-cu11==8.5.0.96
  Downloading nvidia_cudnn_cu11-8.5.0.96-2-py3-none-manylinux1_x86_64.whl (557.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 557.1/557.1 MB 2.5 MB/s eta 0:00:0000:0100:01
Collecting nvidia-nvtx-cu11==11.7.91
  Downloading nvidia_nvtx_cu11-11.7.91-py3-none-manylinux1_x86_64.whl (98 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.6/98.6 kB 27.7 MB/s eta 0:00:00
Collecting nvidia-nccl-cu11==2.14.3
  Downloading nvidia_nccl_cu11-2.14.3-py3-none-manylinux1_x86_64.whl (177.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 177.1/177.1 MB 7.8 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: networkx in /usr/local/lib/python3.9/dist-packages (from torch==2.0.1->-r requirements.txt (line 2)) (3.0)
Collecting nvidia-cufft-cu11==10.9.0.58
  Downloading nvidia_cufft_cu11-10.9.0.58-py3-none-manylinux1_x86_64.whl (168.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 168.4/168.4 MB 5.2 MB/s eta 0:00:0000:0100:01
Collecting nvidia-cuda-cupti-cu11==11.7.101
  Downloading nvidia_cuda_cupti_cu11-11.7.101-py3-none-manylinux1_x86_64.whl (11.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.8/11.8 MB 47.5 MB/s eta 0:00:0000:0100:01
Collecting triton==2.0.0
  Downloading https://download.pytorch.org/whl/triton-2.0.0-1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (63.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.3/63.3 MB 21.9 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: jinja2 in /usr/local/lib/python3.9/dist-packages (from torch==2.0.1->-r requirements.txt (line 2)) (3.1.2)
Collecting nvidia-cusparse-cu11==11.7.4.91
  Downloading nvidia_cusparse_cu11-11.7.4.91-py3-none-manylinux1_x86_64.whl (173.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 173.2/173.2 MB 8.2 MB/s eta 0:00:0000:0100:01
Collecting nvidia-curand-cu11==10.2.10.91
  Downloading nvidia_curand_cu11-10.2.10.91-py3-none-manylinux1_x86_64.whl (54.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.6/54.6 MB 25.1 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: pandas in /usr/local/lib/python3.9/dist-packages (from gradio==3.11.0->-r requirements.txt (line 11)) (1.5.0)
Requirement already satisfied: aiohttp in /usr/local/lib/python3.9/dist-packages (from gradio==3.11.0->-r requirements.txt (line 11)) (3.8.3)
Collecting httpx
  Downloading httpx-0.24.1-py3-none-any.whl (75 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 75.4/75.4 kB 23.5 MB/s eta 0:00:00
Collecting orjson
  Downloading orjson-3.9.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (138 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 138.6/138.6 kB 35.9 MB/s eta 0:00:00
Collecting pycryptodome
  Downloading pycryptodome-3.18.0-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 50.1 MB/s eta 0:00:0000:01
Collecting h11<0.13,>=0.11
  Downloading h11-0.12.0-py3-none-any.whl (54 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.9/54.9 kB 15.0 MB/s eta 0:00:00
Collecting paramiko
  Downloading paramiko-3.2.0-py3-none-any.whl (224 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 224.2/224.2 kB 43.8 MB/s eta 0:00:00
Collecting websockets>=10.0
  Downloading websockets-11.0.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 129.7/129.7 kB 31.1 MB/s eta 0:00:00
Requirement already satisfied: matplotlib in /usr/local/lib/python3.9/dist-packages (from gradio==3.11.0->-r requirements.txt (line 11)) (3.6.1)
Collecting fastapi
  Downloading fastapi-0.100.0-py3-none-any.whl (65 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.7/65.7 kB 17.5 MB/s eta 0:00:00
Requirement already satisfied: pydantic in /usr/local/lib/python3.9/dist-packages (from gradio==3.11.0->-r requirements.txt (line 11)) (1.9.2)
Requirement already satisfied: pyyaml in /usr/local/lib/python3.9/dist-packages (from gradio==3.11.0->-r requirements.txt (line 11)) (5.4.1)
Collecting python-multipart
  Downloading python_multipart-0.0.6-py3-none-any.whl (45 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.7/45.7 kB 13.9 MB/s eta 0:00:00
Collecting ffmpy
  Downloading ffmpy-0.3.1.tar.gz (5.5 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: requests in /usr/local/lib/python3.9/dist-packages (from gradio==3.11.0->-r requirements.txt (line 11)) (2.28.2)
Requirement already satisfied: pillow in /usr/local/lib/python3.9/dist-packages (from gradio==3.11.0->-r requirements.txt (line 11)) (9.2.0)
Requirement already satisfied: markdown-it-py[linkify,plugins] in /usr/local/lib/python3.9/dist-packages (from gradio==3.11.0->-r requirements.txt (line 11)) (2.1.0)
Collecting pydub
  Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)
Collecting uvicorn
  Downloading uvicorn-0.23.1-py3-none-any.whl (59 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.5/59.5 kB 16.5 MB/s eta 0:00:00
Requirement already satisfied: fsspec in /usr/local/lib/python3.9/dist-packages (from gradio==3.11.0->-r requirements.txt (line 11)) (2023.1.0)
Requirement already satisfied: wheel in /usr/local/lib/python3.9/dist-packages (from nvidia-cublas-cu11==11.10.3.66->torch==2.0.1->-r requirements.txt (line 2)) (0.35.1)
Requirement already satisfied: setuptools in /usr/local/lib/python3.9/dist-packages (from nvidia-cublas-cu11==11.10.3.66->torch==2.0.1->-r requirements.txt (line 2)) (66.1.1)
Collecting cmake
  Downloading cmake-3.27.0-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (26.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 26.0/26.0 MB 20.2 MB/s eta 0:00:0000:0100:01
Collecting lit
  Downloading lit-16.0.6.tar.gz (153 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 153.7/153.7 kB 13.1 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: psutil in /usr/local/lib/python3.9/dist-packages (from accelerate->-r requirements.txt (line 4)) (5.9.4)
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.9/dist-packages (from accelerate->-r requirements.txt (line 4)) (23.0)
Requirement already satisfied: huggingface-hub<1.0,>=0.1.0 in /usr/local/lib/python3.9/dist-packages (from transformers->-r requirements.txt (line 5)) (0.12.0)
Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.9/dist-packages (from transformers->-r requirements.txt (line 5)) (2022.10.31)
Requirement already satisfied: tokenizers!=0.11.3,<0.13,>=0.11.1 in /usr/local/lib/python3.9/dist-packages (from transformers->-r requirements.txt (line 5)) (0.12.1)
Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.9/dist-packages (from transformers->-r requirements.txt (line 5)) (4.64.1)
Collecting huggingface-hub<1.0,>=0.1.0
  Downloading huggingface_hub-0.16.4-py3-none-any.whl (268 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 268.8/268.8 kB 46.8 MB/s eta 0:00:00
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.9/dist-packages (from diffusers==0.19.0.dev0->-r requirements.txt (line 12)) (6.0.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.9/dist-packages (from aiohttp->gradio==3.11.0->-r requirements.txt (line 11)) (6.0.4)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.9/dist-packages (from aiohttp->gradio==3.11.0->-r requirements.txt (line 11)) (1.3.1)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.9/dist-packages (from aiohttp->gradio==3.11.0->-r requirements.txt (line 11)) (4.0.2)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.9/dist-packages (from aiohttp->gradio==3.11.0->-r requirements.txt (line 11)) (1.8.2)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.9/dist-packages (from aiohttp->gradio==3.11.0->-r requirements.txt (line 11)) (1.3.3)
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.9/dist-packages (from aiohttp->gradio==3.11.0->-r requirements.txt (line 11)) (18.2.0)
Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /usr/local/lib/python3.9/dist-packages (from aiohttp->gradio==3.11.0->-r requirements.txt (line 11)) (2.1.1)
Collecting typing-extensions
  Downloading typing_extensions-4.7.1-py3-none-any.whl (33 kB)
Collecting starlette<0.28.0,>=0.27.0
  Downloading starlette-0.27.0-py3-none-any.whl (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 67.0/67.0 kB 18.9 MB/s eta 0:00:00
Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from httpx->gradio==3.11.0->-r requirements.txt (line 11)) (2019.11.28)
Requirement already satisfied: sniffio in /usr/local/lib/python3.9/dist-packages (from httpx->gradio==3.11.0->-r requirements.txt (line 11)) (1.3.0)
Collecting httpcore<0.18.0,>=0.15.0
  Downloading httpcore-0.17.3-py3-none-any.whl (74 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 74.5/74.5 kB 22.6 MB/s eta 0:00:00
Requirement already satisfied: idna in /usr/lib/python3/dist-packages (from httpx->gradio==3.11.0->-r requirements.txt (line 11)) (2.8)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.9/dist-packages (from importlib-metadata->diffusers==0.19.0.dev0->-r requirements.txt (line 12)) (3.11.0)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.9/dist-packages (from jinja2->torch==2.0.1->-r requirements.txt (line 2)) (2.1.2)
Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.9/dist-packages (from markdown-it-py[linkify,plugins]->gradio==3.11.0->-r requirements.txt (line 11)) (0.1.2)
Collecting linkify-it-py~=1.0
  Downloading linkify_it_py-1.0.3-py3-none-any.whl (19 kB)
Collecting mdit-py-plugins
  Downloading mdit_py_plugins-0.4.0-py3-none-any.whl (54 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.1/54.1 kB 15.9 MB/s eta 0:00:00
Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.9/dist-packages (from matplotlib->gradio==3.11.0->-r requirements.txt (line 11)) (2.8.2)
Requirement already satisfied: pyparsing>=2.2.1 in /usr/local/lib/python3.9/dist-packages (from matplotlib->gradio==3.11.0->-r requirements.txt (line 11)) (3.0.9)
Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.9/dist-packages (from matplotlib->gradio==3.11.0->-r requirements.txt (line 11)) (4.38.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.9/dist-packages (from matplotlib->gradio==3.11.0->-r requirements.txt (line 11)) (1.4.4)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.9/dist-packages (from matplotlib->gradio==3.11.0->-r requirements.txt (line 11)) (0.11.0)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.9/dist-packages (from matplotlib->gradio==3.11.0->-r requirements.txt (line 11)) (1.0.7)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.9/dist-packages (from pandas->gradio==3.11.0->-r requirements.txt (line 11)) (2022.7.1)
Collecting bcrypt>=3.2
  Downloading bcrypt-4.0.1-cp36-abi3-manylinux_2_28_x86_64.whl (593 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 593.7/593.7 kB 42.3 MB/s eta 0:00:00
Collecting pynacl>=1.5
  Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 39.3 MB/s eta 0:00:00
Collecting cryptography>=3.3
  Downloading cryptography-41.0.2-cp37-abi3-manylinux_2_28_x86_64.whl (4.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 51.5 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/dist-packages (from requests->gradio==3.11.0->-r requirements.txt (line 11)) (1.26.14)
Collecting mpmath>=0.19
  Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 47.9 MB/s eta 0:00:00
Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.9/dist-packages (from uvicorn->gradio==3.11.0->-r requirements.txt (line 11)) (8.1.3)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.9/dist-packages (from cryptography>=3.3->paramiko->gradio==3.11.0->-r requirements.txt (line 11)) (1.15.1)
Collecting httpcore<0.18.0,>=0.15.0
  Downloading httpcore-0.17.2-py3-none-any.whl (72 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 72.5/72.5 kB 21.9 MB/s eta 0:00:00
  Downloading httpcore-0.17.1-py3-none-any.whl (70 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.9/70.9 kB 21.9 MB/s eta 0:00:00
  Downloading httpcore-0.17.0-py3-none-any.whl (70 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.6/70.6 kB 19.5 MB/s eta 0:00:00
  Downloading httpcore-0.16.3-py3-none-any.whl (69 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 69.6/69.6 kB 21.5 MB/s eta 0:00:00
  Downloading httpcore-0.16.2-py3-none-any.whl (68 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 69.0/69.0 kB 18.0 MB/s eta 0:00:00
  Downloading httpcore-0.16.1-py3-none-any.whl (68 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 68.7/68.7 kB 19.6 MB/s eta 0:00:00
  Downloading httpcore-0.16.0-py3-none-any.whl (68 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 68.7/68.7 kB 18.9 MB/s eta 0:00:00
  Downloading httpcore-0.15.0-py3-none-any.whl (68 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 68.4/68.4 kB 20.8 MB/s eta 0:00:00
Requirement already satisfied: anyio==3.* in /usr/local/lib/python3.9/dist-packages (from httpcore<0.18.0,>=0.15.0->httpx->gradio==3.11.0->-r requirements.txt (line 11)) (3.6.2)
Collecting uc-micro-py
  Downloading uc_micro_py-1.0.2-py3-none-any.whl (6.2 kB)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7->matplotlib->gradio==3.11.0->-r requirements.txt (line 11)) (1.14.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.9/dist-packages (from cffi>=1.12->cryptography>=3.3->paramiko->gradio==3.11.0->-r requirements.txt (line 11)) (2.21)
Building wheels for collected packages: diffusers, ffmpy, lit
  Building wheel for diffusers (pyproject.toml) ... done
  Created wheel for diffusers: filename=diffusers-0.19.0.dev0-py3-none-any.whl size=1279485 sha256=bce930b816e9fb37ed905be995cc3b67de33bdd37261bbf6bd1fb06a49fa5859
  Stored in directory: /tmp/pip-ephem-wheel-cache-pdxjsvqb/wheels/3a/75/ac/2724a3c688984d6b999006bb9f6b10275f59cf50377b74c585
  Building wheel for ffmpy (setup.py) ... done
  Created wheel for ffmpy: filename=ffmpy-0.3.1-py3-none-any.whl size=5579 sha256=0082c4918d78568e05e2599a6a85b448214bb148abbabb990c7564a736856c27
  Stored in directory: /root/.cache/pip/wheels/3c/79/71/1b3a0bc0ca224fc8af5087101cf28adc0054ea6521c4b758ec
  Building wheel for lit (pyproject.toml) ... done
  Created wheel for lit: filename=lit-16.0.6-py3-none-any.whl size=93582 sha256=e23a707cc4a4f5b379cafa71a344b9707ab2de493ae4ddcdc2d714ead2956b43
  Stored in directory: /root/.cache/pip/wheels/dd/a1/9c/f4e974f934c7a715a884a029e8b2b0b438486e654058fe8c80
Successfully built diffusers ffmpy lit
Installing collected packages: safetensors, pydub, mpmath, lit, ffmpy, cmake, websockets, uc-micro-py, typing-extensions, sympy, python-multipart, python-dotenv, pycryptodome, orjson, nvidia-nvtx-cu11, nvidia-nccl-cu11, nvidia-cusparse-cu11, nvidia-curand-cu11, nvidia-cufft-cu11, nvidia-cuda-runtime-cu11, nvidia-cuda-nvrtc-cu11, nvidia-cuda-cupti-cu11, nvidia-cublas-cu11, h11, bcrypt, uvicorn, starlette, pynacl, nvidia-cusolver-cu11, nvidia-cudnn-cu11, mdit-py-plugins, linkify-it-py, huggingface-hub, httpcore, cryptography, paramiko, httpx, fastapi, diffusers, gradio, triton, torch, invisible-watermark, accelerate
  Attempting uninstall: typing-extensions
    Found existing installation: typing_extensions 4.4.0
    Uninstalling typing_extensions-4.4.0:
      Successfully uninstalled typing_extensions-4.4.0
  Attempting uninstall: huggingface-hub
    Found existing installation: huggingface-hub 0.12.0
    Uninstalling huggingface-hub-0.12.0:
      Successfully uninstalled huggingface-hub-0.12.0
  Attempting uninstall: torch
    Found existing installation: torch 1.12.1+cu116
    Uninstalling torch-1.12.1+cu116:
      Successfully uninstalled torch-1.12.1+cu116
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchvision 0.13.1+cu116 requires torch==1.12.1, but you have torch 2.0.1 which is incompatible.
torchaudio 0.12.1+cu116 requires torch==1.12.1, but you have torch 2.0.1 which is incompatible.
Successfully installed accelerate-0.21.0 bcrypt-4.0.1 cmake-3.27.0 cryptography-41.0.2 diffusers-0.19.0.dev0 fastapi-0.100.0 ffmpy-0.3.1 gradio-3.11.0 h11-0.12.0 httpcore-0.15.0 httpx-0.24.1 huggingface-hub-0.16.4 invisible-watermark-0.2.0 linkify-it-py-1.0.3 lit-16.0.6 mdit-py-plugins-0.4.0 mpmath-1.3.0 nvidia-cublas-cu11-11.10.3.66 nvidia-cuda-cupti-cu11-11.7.101 nvidia-cuda-nvrtc-cu11-11.7.99 nvidia-cuda-runtime-cu11-11.7.99 nvidia-cudnn-cu11-8.5.0.96 nvidia-cufft-cu11-10.9.0.58 nvidia-curand-cu11-10.2.10.91 nvidia-cusolver-cu11-11.4.0.1 nvidia-cusparse-cu11-11.7.4.91 nvidia-nccl-cu11-2.14.3 nvidia-nvtx-cu11-11.7.91 orjson-3.9.2 paramiko-3.2.0 pycryptodome-3.18.0 pydub-0.25.1 pynacl-1.5.0 python-dotenv-1.0.0 python-multipart-0.0.6 safetensors-0.3.1 starlette-0.27.0 sympy-1.12 torch-2.0.1 triton-2.0.0 typing-extensions-4.7.1 uc-micro-py-1.0.2 uvicorn-0.23.1 websockets-11.0.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Collecting omegaconf
  Downloading omegaconf-2.3.0-py3-none-any.whl (79 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 kB 15.8 MB/s eta 0:00:00
Collecting einops
  Downloading einops-0.6.1-py3-none-any.whl (42 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.2/42.2 kB 11.3 MB/s eta 0:00:00
Requirement already satisfied: transformers in /usr/local/lib/python3.9/dist-packages (4.21.3)
Collecting transformers
  Downloading transformers-4.31.0-py3-none-any.whl (7.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.4/7.4 MB 66.0 MB/s eta 0:00:0000:01:00:01
Requirement already satisfied: pydantic in /usr/local/lib/python3.9/dist-packages (1.9.2)
Collecting pydantic
  Downloading pydantic-2.0.3-py3-none-any.whl (364 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 364.0/364.0 kB 56.2 MB/s eta 0:00:00
Collecting open_clip_torch
  Downloading open_clip_torch-2.20.0-py3-none-any.whl (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 58.1 MB/s eta 0:00:00
Collecting antlr4-python3-runtime==4.9.*
  Downloading antlr4-python3-runtime-4.9.3.tar.gz (117 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.0/117.0 kB 26.5 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: PyYAML>=5.1.0 in /usr/local/lib/python3.9/dist-packages (from omegaconf) (5.4.1)
Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.9/dist-packages (from transformers) (2022.10.31)
Requirement already satisfied: filelock in /usr/local/lib/python3.9/dist-packages (from transformers) (3.9.0)
Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in /usr/local/lib/python3.9/dist-packages (from transformers) (0.12.1)
Requirement already satisfied: requests in /usr/local/lib/python3.9/dist-packages (from transformers) (2.28.2)
Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.9/dist-packages (from transformers) (1.23.4)
Requirement already satisfied: huggingface-hub<1.0,>=0.14.1 in /usr/local/lib/python3.9/dist-packages (from transformers) (0.16.4)
Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.9/dist-packages (from transformers) (4.64.1)
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.9/dist-packages (from transformers) (23.0)
Requirement already satisfied: safetensors>=0.3.1 in /usr/local/lib/python3.9/dist-packages (from transformers) (0.3.1)
Requirement already satisfied: typing-extensions>=4.6.1 in /usr/local/lib/python3.9/dist-packages (from pydantic) (4.7.1)
Collecting annotated-types>=0.4.0
  Downloading annotated_types-0.5.0-py3-none-any.whl (11 kB)
Collecting pydantic-core==2.3.0
  Downloading pydantic_core-2.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 46.0 MB/s eta 0:00:0000:01
Requirement already satisfied: torch>=1.9.0 in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (2.0.1)
Requirement already satisfied: sentencepiece in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (0.1.97)
Requirement already satisfied: torchvision in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (0.13.1+cu116)
Collecting timm
  Downloading timm-0.9.2-py3-none-any.whl (2.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 41.3 MB/s eta 0:00:00a 0:00:01
Requirement already satisfied: protobuf<4 in /usr/local/lib/python3.9/dist-packages (from open_clip_torch) (3.19.6)
Collecting ftfy
  Downloading ftfy-6.1.1-py3-none-any.whl (53 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.1/53.1 kB 15.5 MB/s eta 0:00:00
Requirement already satisfied: fsspec in /usr/local/lib/python3.9/dist-packages (from huggingface-hub<1.0,>=0.14.1->transformers) (2023.1.0)
Requirement already satisfied: nvidia-cuda-nvrtc-cu11==11.7.99 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (11.7.99)
Requirement already satisfied: sympy in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (1.12)
Requirement already satisfied: nvidia-cudnn-cu11==8.5.0.96 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (8.5.0.96)
Requirement already satisfied: nvidia-cublas-cu11==11.10.3.66 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (11.10.3.66)
Requirement already satisfied: nvidia-cusolver-cu11==11.4.0.1 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (11.4.0.1)
Requirement already satisfied: networkx in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (3.0)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (3.1.2)
Requirement already satisfied: nvidia-cuda-cupti-cu11==11.7.101 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (11.7.101)
Requirement already satisfied: nvidia-cufft-cu11==10.9.0.58 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (10.9.0.58)
Requirement already satisfied: nvidia-nccl-cu11==2.14.3 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (2.14.3)
Requirement already satisfied: triton==2.0.0 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (2.0.0)
Requirement already satisfied: nvidia-cuda-runtime-cu11==11.7.99 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (11.7.99)
Requirement already satisfied: nvidia-curand-cu11==10.2.10.91 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (10.2.10.91)
Requirement already satisfied: nvidia-nvtx-cu11==11.7.91 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (11.7.91)
Requirement already satisfied: nvidia-cusparse-cu11==11.7.4.91 in /usr/local/lib/python3.9/dist-packages (from torch>=1.9.0->open_clip_torch) (11.7.4.91)
Requirement already satisfied: setuptools in /usr/local/lib/python3.9/dist-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=1.9.0->open_clip_torch) (66.1.1)
Requirement already satisfied: wheel in /usr/local/lib/python3.9/dist-packages (from nvidia-cublas-cu11==11.10.3.66->torch>=1.9.0->open_clip_torch) (0.35.1)
Requirement already satisfied: lit in /usr/local/lib/python3.9/dist-packages (from triton==2.0.0->torch>=1.9.0->open_clip_torch) (16.0.6)
Requirement already satisfied: cmake in /usr/local/lib/python3.9/dist-packages (from triton==2.0.0->torch>=1.9.0->open_clip_torch) (3.27.0)
Requirement already satisfied: wcwidth>=0.2.5 in /usr/local/lib/python3.9/dist-packages (from ftfy->open_clip_torch) (0.2.6)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.9/dist-packages (from requests->transformers) (2.1.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests->transformers) (2019.11.28)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests->transformers) (2.8)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/dist-packages (from requests->transformers) (1.26.14)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /usr/local/lib/python3.9/dist-packages (from torchvision->open_clip_torch) (9.2.0)
Collecting torch>=1.9.0
  Downloading torch-1.12.1-cp39-cp39-manylinux1_x86_64.whl (776.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 776.4/776.4 MB 2.7 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.9/dist-packages (from jinja2->torch>=1.9.0->open_clip_torch) (2.1.2)
Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.9/dist-packages (from sympy->torch>=1.9.0->open_clip_torch) (1.3.0)
Building wheels for collected packages: antlr4-python3-runtime
  Building wheel for antlr4-python3-runtime (setup.py) ... done
  Created wheel for antlr4-python3-runtime: filename=antlr4_python3_runtime-4.9.3-py3-none-any.whl size=144554 sha256=9fe0ddff8f3b3ec3d8c0f517bb23510fc2b0e5d90315f17b230b1682d8444827
  Stored in directory: /root/.cache/pip/wheels/a7/72/3e/7d4bb4df2f34e8a15d0d764bb98e7ca19a765483710646a8b3
Successfully built antlr4-python3-runtime
Installing collected packages: antlr4-python3-runtime, torch, pydantic-core, omegaconf, ftfy, einops, annotated-types, pydantic, transformers, timm, open_clip_torch
  Attempting uninstall: torch
    Found existing installation: torch 2.0.1
    Uninstalling torch-2.0.1:
      Successfully uninstalled torch-2.0.1
  Attempting uninstall: pydantic
    Found existing installation: pydantic 1.9.2
    Uninstalling pydantic-1.9.2:
      Successfully uninstalled pydantic-1.9.2
  Attempting uninstall: transformers
    Found existing installation: transformers 4.21.3
    Uninstalling transformers-4.21.3:
      Successfully uninstalled transformers-4.21.3
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
thinc 8.1.7 requires pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4, but you have pydantic 2.0.3 which is incompatible.
spacy 3.4.1 requires pydantic!=1.8,!=1.8.1,<1.10.0,>=1.7.4, but you have pydantic 2.0.3 which is incompatible.
confection 0.0.4 requires pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4, but you have pydantic 2.0.3 which is incompatible.
Successfully installed annotated-types-0.5.0 antlr4-python3-runtime-4.9.3 einops-0.6.1 ftfy-6.1.1 omegaconf-2.3.0 open_clip_torch-2.20.0 pydantic-2.0.3 pydantic-core-2.3.0 timm-0.9.2 torch-1.12.1 transformers-4.31.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

③チェックポイントファイルの取得は飛ばします。
 実は実行してみて、うまくいきませんでした。
 ・アクセストークンを設定しても、ユーザ名の入力を求められました。
 ・ターミナルからコマンド実行するとファイルを取得したが、150GB以上あり、容量オーバーしました。
結局、ここは無くても画像生成できるので、飛ばします。

チェックポイントの取得コマンド

④セルを実行します。ENABLE_REFINER=trueに変更します。(falseはfreeのColab用とのことなので)

セルを実行

すると以下のメッセージが出ました。エラーです。

Loading model /notebooks/SDXL/stable-diffusion-xl-base-0.9
Traceback (most recent call last):
  File "/notebooks/app.py", line 39, in <module>
    pipe = DiffusionPipeline.from_pretrained(model_key_base, torch_dtype=torch.float16, use_safetensors=True, variant="fp16", use_auth_token=access_token)
  File "/usr/local/lib/python3.9/dist-packages/diffusers/pipelines/pipeline_utils.py", line 884, in from_pretrained
    cached_folder = cls.download(
  File "/usr/local/lib/python3.9/dist-packages/diffusers/pipelines/pipeline_utils.py", line 1253, in download
    info = model_info(
  File "/usr/local/lib/python3.9/dist-packages/huggingface_hub/utils/_validators.py", line 110, in _inner_fn
    validate_repo_id(arg_value)
  File "/usr/local/lib/python3.9/dist-packages/huggingface_hub/utils/_validators.py", line 158, in validate_repo_id
    raise HFValidationError(
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/notebooks/SDXL/stable-diffusion-xl-base-0.9'. Use `repo_type` argument if needed.

ChatGPTにエラーメッセージを投げて質問したり、デバッグ文を app.pyに入れたりして調べた結果、セルの3行目、SDXL_MODEL_DIR="SDXL/"を削ることで解決しました。

!PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128 ACCESS_TOKEN={access_token} SHARE=true ENABLE_REFINER=true python app.py

これを実行すると、デモ画面へのリンクURLが表示されました。

Loading model stabilityai/stable-diffusion-xl-base-0.9
Loading pipeline components...: 100%|█████████████| 7/7 [00:02<00:00,  2.48it/s]
Loading model stabilityai/stable-diffusion-xl-refiner-0.9
Loading pipeline components...: 100%|█████████████| 5/5 [00:01<00:00,  3.21it/s]
/usr/local/lib/python3.9/dist-packages/gradio/layouts.py:75: UserWarning: mobile_collapse is no longer supported.
  warnings.warn("mobile_collapse is no longer supported.")
/usr/local/lib/python3.9/dist-packages/gradio/components.py:198: UserWarning: 'rounded' styling is no longer supported. To round adjacent components together, place them in a Column(variant='box').
  warnings.warn(
/usr/local/lib/python3.9/dist-packages/gradio/components.py:216: UserWarning: 'border' styling is no longer supported. To place adjacent components in a shared border, place them in a Column(variant='box').
  warnings.warn(
/usr/local/lib/python3.9/dist-packages/gradio/components.py:207: UserWarning: 'margin' styling is no longer supported. To place adjacent components together without margin, place them in a Column(variant='box').
  warnings.warn(
Running on local URL:  http://127.0.0.1:7860
Running on public URL: https://5315b1677e57a056.gradio.app

This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces

リンクをクリックするとデモ画面が表示されました。

デモ画面

Advanced settingsです。

Adbanced settings


プロンプトを入力して生成してみます。
Prompt:  A young woman is playing in the sea on a summer night. She has a bob haircut and natural makeup. She is wearing a dress and sandals and is playing in the water. She is laughing happily and is being hit by the waves.
Negative Prompt:  なし

生成中の様子

2~3分くらいして、画像が4枚生成されました。

A young woman is playing in the sea on a summer night. She has a bob haircut and natural makeup. She is wearing a dress and sandals and is playing in the water. She is laughing happily and is being hit by the waves.Negative Prompt:  なし

画像のクオリティはさておき、普通の文章でプロンプトを指定し、記載している内容、ヘアスタイルやウェア、場所の設定などが再現されています。

他にも試してみます。
続けて作成しようとするとエラーが発生しました。

/usr/local/lib/python3.9/dist-packages/pydantic/main.py:292: UserWarning: Pydantic serializer warnings:
  Expected `int` but got `float` - serialized value may not be as expected
  return self.__pydantic_serializer__.to_python(
100%|███████████████████████████████████████████| 50/50 [01:58<00:00,  2.37s/it]
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/gradio/routes.py", line 292, in run_predict
    output = await app.blocks.process_api(
  File "/usr/local/lib/python3.9/dist-packages/gradio/blocks.py", line 1007, in process_api
    result = await self.call_function(fn_index, inputs, iterator, request)
  File "/usr/local/lib/python3.9/dist-packages/gradio/blocks.py", line 848, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.9/dist-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.9/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.9/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/notebooks/app.py", line 84, in infer
    images = pipe(prompt=prompt, negative_prompt=negative, guidance_scale=guidance_scale, num_inference_steps=steps, height = height, width = width).images
  File "/usr/local/lib/python3.9/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 830, in __call__
    image = self.vae.decode(latents / self.vae.config.scaling_factor, return_dict=False)[0]
  File "/usr/local/lib/python3.9/dist-packages/diffusers/utils/accelerate_utils.py", line 46, in wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/diffusers/models/autoencoder_kl.py", line 270, in decode
    decoded = self._decode(z).sample
  File "/usr/local/lib/python3.9/dist-packages/diffusers/models/autoencoder_kl.py", line 256, in _decode
    z = self.post_quant_conv(z)
  File "/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/torch/nn/modules/conv.py", line 457, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/usr/local/lib/python3.9/dist-packages/torch/nn/modules/conv.py", line 453, in _conv_forward
    return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same


調査は別途するとして、ここではセルを再度実行(Stop→Start)します。
以下のプロンプトで生成します。
Prompt: Photo of a beautiful woman, (masterpiece, best quality,absurdres, Ultra HD, Sharp) exceptional, best aesthetic, natural lighting, instagram [:detailed_face:6],close up,
Negative Prompt: (nsfw:1.5),(worst quality, low quality:2)

実行ログです

This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces
100%|███████████████████████████████████████████| 50/50 [03:17<00:00,  3.96s/it]
100%|█████████████████████████████████████████████| 4/4 [00:17<00:00,  4.39s/it]

生成画像です。高さ512x 幅 768としています。

Photo of a beautiful woman, (masterpiece, best quality,absurdres, Ultra HD, Sharp) exceptional, best aesthetic, natural lighting, instagram [:detailed_face:6],close up,

クオリティアップ用の呪文は効いているようです。
今後、詳細を調べてみます。

さらに生成したサンプルを追記します。

Prompt: (masterpiece:1.3), (8k, photorealistic, RAW photo, best quality: 1.4), (1girl), beautiful face, (realistic face), (black hair, short hair:1.3), beautiful hairstyle, realistic eyes, beautiful detailed eyes, (realistic skin), beautiful skin, (sweater), absurdres, attractive, ultra high res, ultra realistic, highly detailed, golden ratio
Negative Prompt: なし
※プロンプトの文字数が超過して、後ろは切り捨てられていますが、メモし忘れました。

(masterpiece:1.3), (8k, photorealistic, RAW photo, best quality: 1.4), (1girl), beautiful face, (realistic face), (black hair, short hair:1.3), beautiful hairstyle, realistic eyes, beautiful detailed eyes, (realistic skin), beautiful skin, (sweater), absurdres, attractive, ultra high res, ultra realistic, highly detailed, golden ratio

Prompt: Woman sitting on chair with legs crossed,brown eyes, in the office, best quality,masterpiece,ultra high res,(photo realistic:1.4), Cinematic, 35mm lens, f/ 1. 8, accent lighting, 8k,
Negative Prompt: なし

Woman sitting on chair with legs crossed,brown eyes, in the office, best quality,masterpiece,ultra high res,(photo realistic:1.4), Cinematic, 35mm lens, f/ 1. 8, accent lighting, 8k,

Prompt:  Impressionist painting. masterpiece. A woman with a parasol stands on a bridge over a pond of water lilies.

Impressionist painting. masterpiece. A woman with a parasol stands on a bridge over a pond of water lilies.

Prompt: (Modern European Ink Painting:1.3), (masterpiece, top quality, best quality, official art, beautiful and aesthetic:1.2), (1girl:1.3), extremely detailed,(zentangle:1.2), (dynamic pose), upper body, detailed body
Negative Prompt: low quality

(Modern European Ink Painting:1.3), (masterpiece, top quality, best quality, official art, beautiful and aesthetic:1.2), (1girl:1.3), extremely detailed,(zentangle:1.2), (dynamic pose), upper body, detailed body

(Modern European Ink Painting:1.3), (masterpiece, top quality, best quality, official art, beautiful and aesthetic:1.2), (1girl:1.3), detailed face, detailed body

949363713

(engraving:1.3), (masterpiece, top quality, best quality, official art, beautiful and aesthetic:1.2), (1girl:1.3), detailed face, detailed body

949363713

Woman sitting on chair with legs crossed,brown eyes, in the office, best quality,masterpiece,ultra high res,(photo realistic:1.4), Cinematic, 35mm lens, f/ 1. 8, accent lighting, 8k,
Negative Prompt: (worst quality:2), (low quality:2), (normal quality:2),

Photo of a beautiful woman, (masterpiece, best quality,absurdres, Ultra HD, Sharp) exceptional, best aesthetic, natural lighting, instagram [:detailed_face:6], blunt bob hairstyle, flowy sundresses, crop tops, and high-waisted shorts, statement jewelry and cute sandals, Sitting with Knees Up
Negative Prompt: multiple girls (worst quality:2), (low quality:2), (normal quality:2)



Photo of a beautiful woman, (masterpiece, best quality,absurdres, Ultra HD, Sharp) exceptional, best aesthetic, natural lighting, instagram [:detailed_face:6],close up,
Negative Prompt:  multiple girls (worst quality:2), (low quality:2), (normal quality:2)


48099743

(Modern European Ink Painting:1.3), (masterpiece, top quality, best quality, official art, beautiful and aesthetic:1.2), (1girl:1.3), detailed face

825874090


Prompt: 間違って→を入力し、太字のところは切り捨て:(Modern European Ink Painting:1.3), (masterpiece, top quality, best quality, official art, beautiful and aesthetic:1.2), (1girl:1.3), detailed face, detailed body 949363713 (engraving:1.3), (masterpiece, top quality, best quality, official art, beautiful and aesthetic:1.2), (1girl:1.3), detailed face, detailed body
Negative prompt:  (worst quality:2), (low quality:2), (normal quality:2),

568292205


724053874 >> 失敗
(Modern European Ink Painting:1.3), (masterpiece, top quality, best quality, official art, beautiful and aesthetic:1.2), (1girl:1.3), detailed face, detailed body

712734549


113150103

2023/08/18 追記
こちらの記事はデモ画面を動かす手順ですが、その後  AUTOMATIC1111/stable-diffusion-webui v1.5.1 が動くようになりましたので、そちらを使うことを推奨します。




この記事が気に入ったらサポートをしてみませんか?