Buckets:

hf-doc-build/doc / diffusers /main /id /using-diffusers /legacy_checkpoints.md
mishig's picture
|
download
raw
3.27 kB
# Checkpoint lama
Pengaturan ini terutama berlaku untuk checkpoint keluarga Stable Diffusion yang lebih lama.
## Pemeriksa keamanan
Diffusers menyediakan [safety checker](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/safety_checker.py) untuk checkpoint Stable Diffusion yang lebih lama untuk mencegah pembuatan konten yang berbahaya. Alat ini menyaring output yang dihasilkan berdasarkan seperangkat konsep berbahaya yang di-hardcode. Model-model yang lebih baru seperti Qwen-Image tidak memiliki checker ini.
Jika Anda ingin menonaktifkan safety checker, berikan `safety_checker=None` di [from_pretrained()](/docs/diffusers/main/id/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained) seperti yang ditunjukkan di bawah ini.
```py
from diffusers import DiffusionPipeline
pipeline = DiffusionPipeline.from_pretrained(
"stable-diffusion-v1-5/stable-diffusion-v1-5", safety_checker=None
)
"""
You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline'> by passing `safety_checker=None`. Ensure that you abide by the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend keeping the safety filter enabled in all public-facing circumstances, disabling it only for use cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 .
"""
```
## Jadwal penskalaan ulang
Denoising dimulai dari noise murni, sehingga rasio sinyal-terhadap-noise (SNR) dimulai dari nol. Beberapa model sebenarnya tidak dimulai dari noise murni, yang membuat ekstrem terang dan gelap sulit dihasilkan.
> [!TIP]
> Latih model Anda sendiri dengan `v_prediction` dengan menambahkan flag `--prediction_type="v_prediction"` ke skrip pelatihan Anda. Anda juga dapat [mencari](https://huggingface.co/search/full-text?q=v_prediction&type=model) model yang sudah ada yang dilatih dengan `v_prediction`.
Untuk model `v_prediction`, aktifkan argumen scheduler ini.
- Set `rescale_betas_zero_snr=True` untuk menskalakan ulang jadwal noise ke langkah waktu terakhir dengan SNR yang benar-benar nol
- Set `timestep_spacing="trailing"` untuk memaksa pengambilan sampel dari timestep terakhir dengan noise murni
```py
from diffusers import DiffusionPipeline, DDIMScheduler
pipeline = DiffusionPipeline.from_pretrained("ptx0/pseudo-journey-v2", device_map="cuda") # or "mps", "xpu", "cpu"
pipeline.scheduler = DDIMScheduler.from_config(
pipeline.scheduler.config, rescale_betas_zero_snr=True, timestep_spacing="trailing"
)
```
Set `guidance_rescale` di pipeline untuk menghindari gambar yang terlalu terang. Nilai yang lebih rendah meningkatkan kecerahan, tetapi beberapa detail mungkin tampak pudar.
```py
prompt = """
cinematic photo of a snowy mountain at night with the northern lights aurora borealis
overhead, 35mm photograph, film, professional, 4k, highly detailed
"""
image = pipeline(prompt, guidance_rescale=0.7).images[0]
```
tanpa SNR nol
dengan SNR nol dan spasi di belakang

Xet Storage Details

Size:
3.27 kB
·
Xet hash:
f62a7fd26f92099f21512e48f3f0b73a13aa9fc0c41f42711a4b35b0a655f63e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.