Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Stable Diffusionを動かしてみる

Henry Cui
September 23, 2022

Stable Diffusionを動かしてみる

Henry Cui

September 23, 2022
Tweet

More Decks by Henry Cui

Other Decks in Technology

Transcript

  1. 自己紹介 ▪ 東京大学理学部情報科学科 ▪ 同大学大学院情報理工学系研究科コンピュター科学専攻 ▪ 博士(情報理工学)取得 • ICMLなどの国際・国内学会・ジャーナルに論文発表 •

    学振DC2・理研AIPセンター研究パートタイマー • AIPチャレンジなどの競争的研究費取得・外国大学への訪問 ▪ 在学中に株式会社パンハウスを共同創業 2
  2. (Text + Image) to Image 生成例 by Stable Diffusion A

    fantasy landscape, trending on artstation 6
  3. 4.2 Gigabytes, or: How to Draw Anything ▪ https://andys.page/posts/how-to-draw/ ▪

    Stable Diffusionを複数回(丁寧に)使えば実現できる 7
  4. 日本版 Stable Diffusion ▪ https://github.com/rinnakk/japanese-stable-diffusion ▪ https://huggingface.co/spaces/rinna/japanese-stable-diffus ion で体験できる ▪

    目的 • Generate Japanese-style images • Understand Japanglish • Understand Japanese unique onomatope • Understand Japanese proper noun ▪ サラリーマン 油絵 10
  5. Optimized Stable Diffusion ▪ https://github.com/basujindal/stable-diffusion ▪ リソースの少ない環境でより効率的に動かせるために最適化 された実装 ▪ The

    code can now generate 512x512 images using under 2.4 GB of GPU VRAM! • 魅力的ですが、後ほどのデモでは optimize されてないライブラリーで 行う 12
  6. 関連研究が集まるところ ▪ NeurIPS 2022 Machine Learning for Creativity and Design

    Workshop ▪ https://neuripscreativityworkshop.github.io/2022/ ▪ 今年年末! 16
  7. シンプルな使い方 (1/2) ▪ 環境構築 • pip install diffusers==0.2.4 transformers==4.21.2 ftfy==6.1.1

    ▪ インポート • from diffusers import StableDiffusionPipeline ▪ パイプラインの準備 • pipe = StableDiffusionPipeline.from_pretrained('CompVis/stable-diffusion -v1-4', use_auth_token=AUTH_TOKEN) 20
  8. シンプルな使い方 (2/2) ▪ 推論パラメータ • inference_kwargs = dict( height=args.height, width=args.width,

    guidance_scale=args.guidance_scale, num_inference_steps=args.num_inference_steps) ▪ 推論 • image = pipe(args.prompt, **inference_kwargs)['sample'][0] 21