svjack's picture
Upload 1392 files
43b7e92 verified
|
raw
history blame
2.38 kB
# 이미지 밝기 μ‘°μ ˆν•˜κΈ°
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>