Instructions to use NadaGh/working with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use NadaGh/working with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("NadaGh/working", dtype=torch.bfloat16, device_map="cuda") prompt = "tst chair" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
์ปค์คํ ํ์ดํ๋ผ์ธ ๋ถ๋ฌ์ค๊ธฐ
[[open-in-colab]]
์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ์ ๋
ผ๋ฌธ์ ๋ช
์๋ ์๋์ ๊ตฌํ์ฒด์ ๋ค๋ฅธ ํํ๋ก ๊ตฌํ๋ ๋ชจ๋ [DiffusionPipeline] ํด๋์ค๋ฅผ ์๋ฏธํฉ๋๋ค. (์๋ฅผ ๋ค์ด, [StableDiffusionControlNetPipeline]๋ "Text-to-Image Generation with ControlNet Conditioning" ํด๋น) ์ด๋ค์ ์ถ๊ฐ ๊ธฐ๋ฅ์ ์ ๊ณตํ๊ฑฐ๋ ํ์ดํ๋ผ์ธ์ ์๋ ๊ตฌํ์ ํ์ฅํฉ๋๋ค.
Speech to Image ๋๋ Composable Stable Diffusion ๊ณผ ๊ฐ์ ๋ฉ์ง ์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ์ด ๋ง์ด ์์ผ๋ฉฐ ์ฌ๊ธฐ์์ ๋ชจ๋ ๊ณต์ ์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ์ ์ฐพ์ ์ ์์ต๋๋ค.
ํ๋ธ์์ ์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ์ ๋ก๋ํ๋ ค๋ฉด, ์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ์ ๋ฆฌํฌ์งํ ๋ฆฌ ID์ (ํ์ดํ๋ผ์ธ ๊ฐ์ค์น ๋ฐ ๊ตฌ์ฑ ์์๋ฅผ ๋ก๋ํ๋ ค๋) ๋ชจ๋ธ์ ๋ฆฌํฌ์งํ ๋ฆฌ ID๋ฅผ ์ธ์๋ก ์ ๋ฌํด์ผ ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์๋ ์์์์๋ hf-internal-testing/diffusers-dummy-pipeline์์ ๋๋ฏธ ํ์ดํ๋ผ์ธ์ ๋ถ๋ฌ์ค๊ณ , google/ddpm-cifar10-32์์ ํ์ดํ๋ผ์ธ์ ๊ฐ์ค์น์ ์ปดํฌ๋ํธ๋ค์ ๋ก๋ํฉ๋๋ค.
๐ ํ๊น ํ์ด์ค ํ๋ธ์์ ์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ์ ๋ถ๋ฌ์ค๋ ๊ฒ์ ๊ณง ํด๋น ์ฝ๋๊ฐ ์์ ํ๋ค๊ณ ์ ๋ขฐํ๋ ๊ฒ์ ๋๋ค. ์ฝ๋๋ฅผ ์๋์ผ๋ก ๋ถ๋ฌ์ค๊ณ ์คํํ๊ธฐ ์์ ๋ฐ๋์ ์จ๋ผ์ธ์ผ๋ก ํด๋น ์ฝ๋์ ์ ๋ขฐ์ฑ์ ๊ฒ์ฌํ์ธ์!
from diffusers import DiffusionPipeline
pipeline = DiffusionPipeline.from_pretrained(
"google/ddpm-cifar10-32", custom_pipeline="hf-internal-testing/diffusers-dummy-pipeline"
)
๊ณต์ ์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ์ ๋ถ๋ฌ์ค๋ ๊ฒ์ ๋น์ทํ์ง๋ง, ๊ณต์ ๋ฆฌํฌ์งํ ๋ฆฌ ID์์ ๊ฐ์ค์น๋ฅผ ๋ถ๋ฌ์ค๋ ๊ฒ๊ณผ ๋๋ถ์ด ํด๋น ํ์ดํ๋ผ์ธ ๋ด์ ์ปดํฌ๋ํธ๋ฅผ ์ง์ ์ง์ ํ๋ ๊ฒ ์ญ์ ๊ฐ๋ฅํฉ๋๋ค. ์๋ ์์ ๋ฅผ ๋ณด๋ฉด ์ปค๋ฎค๋ํฐ CLIP Guided Stable Diffusion ํ์ดํ๋ผ์ธ์ ๋ก๋ํ ๋, ํด๋น ํ์ดํ๋ผ์ธ์์ ์ฌ์ฉํ clip_model ์ปดํฌ๋ํธ์ feature_extractor ์ปดํฌ๋ํธ๋ฅผ ์ง์ ์ค์ ํ๋ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.
from diffusers import DiffusionPipeline
from transformers import CLIPImageProcessor, CLIPModel
clip_model_id = "laion/CLIP-ViT-B-32-laion2B-s34B-b79K"
feature_extractor = CLIPImageProcessor.from_pretrained(clip_model_id)
clip_model = CLIPModel.from_pretrained(clip_model_id)
pipeline = DiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
custom_pipeline="clip_guided_stable_diffusion",
clip_model=clip_model,
feature_extractor=feature_extractor,
)
์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ์ ๋ํ ์์ธํ ๋ด์ฉ์ ์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ ๊ฐ์ด๋๋ฅผ ์ดํด๋ณด์ธ์. ์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ ๋ฑ๋ก์ ๊ด์ฌ์ด ์๋ ๊ฒฝ์ฐ ์ปค๋ฎค๋ํฐ ํ์ดํ๋ผ์ธ์ ๊ธฐ์ฌํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๊ฐ์ด๋๋ฅผ ํ์ธํ์ธ์ !