|
# μ΄λ―Έμ§ λ°κΈ° μ‘°μ νκΈ° |
|
|
|
Stable Diffusion νμ΄νλΌμΈμ [μΌλ°μ μΈ λν¨μ λ
Έμ΄μ¦ μ€μΌμ€κ³Ό μν λ¨κ³μ κ²°ν¨μ΄ μμ](https://huggingface.co/papers/2305.08891) λ
Όλ¬Έμμ μ€λͺ
ν κ²μ²λΌ λ§€μ° λ°κ±°λ μ΄λμ΄ μ΄λ―Έμ§λ₯Ό μμ±νλ λ°λ μ±λ₯μ΄ νλ²ν©λλ€. μ΄ λ
Όλ¬Έμμ μ μν μ루μ
μ νμ¬ [`DDIMScheduler`]μ ꡬνλμ΄ μμΌλ©° μ΄λ―Έμ§μ λ°κΈ°λ₯Ό κ°μ νλ λ° μ¬μ©ν μ μμ΅λλ€. |
|
|
|
<Tip> |
|
|
|
π‘ μ μλ μ루μ
μ λν μμΈν λ΄μ©μ μμ λ§ν¬λ λ
Όλ¬Έμ μ°Έκ³ νμΈμ! |
|
|
|
</Tip> |
|
|
|
ν΄κ²°μ±
μ€ νλλ *v μμΈ‘κ°*κ³Ό *v λ‘μ€*λ‘ λͺ¨λΈμ νλ ¨νλ κ²μ
λλ€. λ€μ flagλ₯Ό [`train_text_to_image.py`](https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py) λλ [`train_text_to_image_lora.py`](https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py) μ€ν¬λ¦½νΈμ μΆκ°νμ¬ `v_prediction`μ νμ±νν©λλ€: |
|
|
|
```bash |
|
--prediction_type="v_prediction" |
|
``` |
|
|
|
μλ₯Ό λ€μ΄, `v_prediction`μΌλ‘ λ―ΈμΈ μ‘°μ λ [`ptx0/pseudo-journey-v2`](https://huggingface.co/ptx0/pseudo-journey-v2) 체ν¬ν¬μΈνΈλ₯Ό μ¬μ©ν΄ λ³΄κ² μ΅λλ€. |
|
|
|
λ€μμΌλ‘ [`DDIMScheduler`]μμ λ€μ νλΌλ―Έν°λ₯Ό μ€μ ν©λλ€: |
|
|
|
1. rescale_betas_zero_snr=True`, λ
Έμ΄μ¦ μ€μΌμ€μ μ λ‘ ν°λ―Έλ μ νΈ λ μ‘μλΉ(SNR)λ‘ μ¬μ‘°μ ν©λλ€. |
|
2. `timestep_spacing="trailing"`, λ§μ§λ§ νμμ€ν
λΆν° μνλ§ μμ |
|
|
|
```py |
|
>>> from diffusers import DiffusionPipeline, DDIMScheduler |
|
|
|
>>> pipeline = DiffusionPipeline.from_pretrained("ptx0/pseudo-journey-v2") |
|
# switch the scheduler in the pipeline to use the DDIMScheduler |
|
|
|
>>> pipeline.scheduler = DDIMScheduler.from_config( |
|
... pipeline.scheduler.config, rescale_betas_zero_snr=True, timestep_spacing="trailing" |
|
... ) |
|
>>> pipeline.to("cuda") |
|
``` |
|
|
|
λ§μ§λ§μΌλ‘ νμ΄νλΌμΈμ λν νΈμΆμμ `guidance_rescale`μ μ€μ νμ¬ κ³Όλ€ λ
ΈμΆμ λ°©μ§ν©λλ€: |
|
|
|
```py |
|
prompt = "A lion in galaxies, spirals, nebulae, stars, smoke, iridescent, intricate detail, octane render, 8k" |
|
image = pipeline(prompt, guidance_rescale=0.7).images[0] |
|
``` |
|
|
|
<div class="flex justify-center"> |
|
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/zero_snr.png"/> |
|
</div> |