見出し画像

Stable Diffusion XL を Google Colabで動かす(デモ)

Stable Diffusion XLをPaperspaceで動かす方法を調べていたら、Google Colabで動くデモの設定が紹介されていたので、試してみました。

Stable Diffusion XL Web Demo on Colab

発見した経緯
1.PaperspaceでStable Diffusion XL を動かす紹介のブログ
2.Paperspace上のデモ画面。ここにColabでの起動リンクがありました。

Paperspace上のStableDiffusion XLデモ画面

3.リンクをクリックすると、Colabページが表示されます。

Google Colabページ

利用登録と起動設定(アクセストークン)

以下の注意書きがあります。アクセストークンを自分で設定せよとのことです。
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.

①StableDiffusionXLのサイトで、フォームから利用登録します。

フォーム

個人の研究活動のため、以下のように記載しました。
・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.

入力後フォーム

②Hugging Faceでアクセストークンを登録
こちらは、もともとHugging faceで登録してあったものを使いました。
詳しくはHugging Faceサイトをご参照ください。

Colabの設定と起動

①ドライブにコピーを保存します

ドライブにコピーを保存

②コピーに対して、Hugging Faceで登録したアクセストークンを設定します。

アクセストークンをColabに設定

③上から順番に、実行していきます。

[1]
[2]

ColabはPro(GPU15GB)を使っているので、ENABLE_REFINER=true に設定しました。

[3]

リンクは毎回変わります。

デモ画面のリンク

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

起動画面

Advanced settingsは以下です。

Advanced settings

試してみると、Images(同時生成枚数)が4だと、Out of Memory となったので、1に変更、
Stepsも50から30に変更、
Seedは-1に変更しました。
検証は別途。

Prompt:  A young woman is watching fireworks at a fireworks festival on a summer night. She has short hair and natural makeup. She is wearing a T-shirt, jeans, and sneakers and is watching the fireworks at the fireworks festival. She is enjoying the fireworks and talking to her friends.
Negative Prompt:  low quality

生成には約2分、要しました。
出来上がりは以下です。プロンプトに書いていることはすべて反映されています。足が崩れているのが惜しいです。

Prompt:  A young woman is watching fireworks at a fireworks festival on a summer night. She has short hair and natural makeup. She is wearing a T-shirt, jeans, and sneakers and is watching the fireworks at the fireworks festival. She is enjoying the fireworks and talking to her friends.Negative Prompt:  low quality

動作が不安定で、1回生成して、もう一度生成しようするとエラーになります。その都度、セルを実行しました。

もう一枚、同じ条件で、プロンプトを変えてみます。
Her hairstyle is a half-up knot, giving a cute impression. She has gold eyeshadow that enhances her eye makeup beautifully. She's wearing an off-shoulder blouse with fringed denim shorts and wedge heel sandals, enjoying a perfect style for an evening date. She's walking through the cityscape during the evening. The setting sun reflects on the glass windows of the buildings, tinting the city in orange hues. People are enjoying their time at cafes and restaurants, creating a lively atmosphere in the city. Her cute style perfectly matches the ambiance of the city.

Her hairstyle is a half-up knot, giving a cute impression. She has gold eyeshadow that enhances her eye makeup beautifully. She's wearing an off-shoulder blouse with fringed denim shorts and wedge heel sandals, enjoying a perfect style for an evening date. She's walking through the cityscape during the evening. The setting sun reflects on the glass windows of the buildings, tinting the city in orange hues. People are enjoying their time at cafes and restaurants, creating a lively atmosphere in the city. Her cute style perfectly matches the ambiance of the city.

プロンプトの内容がほとんど反映されています。さすがですね。

従来形式の指定だとどうなるでしょうか。
(8k, best quality, masterpiece, ultra highres:1.2), (A beautiful woman:2), [long curly blond hair| long wavy crimson hair], (well endowed chest), natural makeup, best skin quality, extremely delicate and beautiful, perfect body, fine features, (beautiful detailed eyes:1.2), top quality, cinematic highlight hair, extreme light and shadow,

(8k, best quality, masterpiece, ultra highres:1.2), (A beautiful woman:2), [long curly blond hair| long wavy crimson hair], (well endowed chest), natural makeup, best skin quality, extremely delicate and beautiful, perfect body, fine features, (beautiful detailed eyes:1.2), top quality, cinematic highlight hair, extreme light and shadow,

従来と同様の指定も有効なようです。
引き続き色々な表現を試してみます。

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