Slide 1

Slide 1 text

除了串 API 之外工程師還能做些什麼 Generative AI Meetup ft. Happy Designer

Slide 2

Slide 2 text

蒼時弦也 Software Developer https://blog.aotoki.me

Slide 3

Slide 3 text

開始之前 生態系進化太快,都不知道該怎麼辦⋯⋯

Slide 4

Slide 4 text

Diffusers 簡單使用 Stable Diffusion 的方法

Slide 5

Slide 5 text

Hugging Face AI 領域的 GitHub,大部分開源模型都可以在上面找到

Slide 6

Slide 6 text

import from import = = = = = torch diffusers StableDiffusionPipeline pipe StableDiffusionPipeline.from_pretrained( , torch.float16) pipe pipe.to( ) prompt image pipe(prompt).images[ ] # 載入模型 # 進行運算 "runwayml/stable- diffusion-v1-5" "cuda" "a photo of an astronaut riding a horse on mars" torch_dtype 0

Slide 7

Slide 7 text

# ... # 載入不同模型 # 多重處理 prompt image txt2image(prompt).images[ ] image upscale(image).images[ ] image image2image(image).images[ ] = = = = "a photo of an astronaut riding a horse on mars" 0 0 0

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

http://bit.ly/3JJf16o

Slide 10

Slide 10 text

Replicate 目前最好用的 Serverless GPU 服務

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

from import import class def def = = = = = return cog BasePredictor, Path, Input torch ( ): (self): (self, image: Path Input( ), scale: Input( , ) ) -> Path: output Predictor BasePredictor setup predict # 初始化、載入模型 # 處理 e.g. Stable Diffusion Pipeline description description default "Image to enlarge" "Factor to scale image by" float 1.5

Slide 13

Slide 13 text

$ $ cog login cog push r8.im your username your model name /< - >/< - - >

Slide 14

Slide 14 text

有 GPU 的伺服器、API 都有了,剩下就是套應用

Slide 15

Slide 15 text

AI Gacha 使用 Diffusers、Replicate 的實驗性專案

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

http://bit.ly/3yImmgc

Slide 18

Slide 18 text

我的看法 能做的事情其實不多,大部分應用的成本也偏高,但是商用已經沒 有問題,剩下要處理的大概會在 跟讓更多人能 合法的版權 輕鬆上手