Buckets:
| # 빠른 시작 | |
| Diffusers는 이미지, 비디오, 오디오 생성을 위한 간편한 추론 API와 새로운 워크플로를 구현하기 위한 빌딩 블록을 제공하는 개발자 및 연구자를 위한 라이브러리입니다. | |
| Diffusers는 제한된 메모리를 가진 환경에서 대규모 모델을 로드하고 실행하거나 추론을 가속화할 수 있도록 다양한 최적화를 기본으로 제공합니다. | |
| 이 Quickstart에서는 Diffusers에 대한 개요를 제공하고 빠르게 생성을 시작할 수 있도록 안내합니다. | |
| > [!TIP] | |
| > 시작하기 전에, [Flux](https://huggingface.co/black-forest-labs/FLUX.1-dev)와 같은 게이트드 모델을 사용하려면 Hugging Face [계정](https://huggingface.co/join)이 있는지 확인하세요. 대신 커스텀 파이프라인을 구축하시나요? [Modular Diffusers quickstart](./modular_diffusers/quickstart)와 [overview](./modular_diffusers/overview)를 참고하세요. | |
| 설치되어 있지 않은 경우 [Installation](./installation) 가이드를 따라 Diffusers를 설치하세요. | |
| ## 에이전트 프롬프트 | |
| … | |
| ```text | |
| Help me get set up with Hugging Face Diffusers for inference. | |
| 1. Install Diffusers for my environment with `uv pip install "diffusers[torch]"`. | |
| 2. If I need gated Hub models, help me authenticate to the Hugging Face Hub. | |
| 3. Install Diffusers coding agent skills with `diffusers-cli skills add diffusers-cli`. Pass `--cursor`, `--claude`, or `--codex` if auto-detect fails. Optionally pass `--all` to install every skill in the registry. | |
| 4. Run a first text-to-image with DiffusionPipeline or `diffusers-cli run`, using a small or current Quickstart model and the right `device_map` for my machine. | |
| 5. Ask what I want next and point me at the matching docs. | |
| ``` | |
| ## DiffusionPipeline | |
| [DiffusionPipeline](/docs/diffusers/v0.43.0/ko/api/pipelines/overview#diffusers.DiffusionPipeline)는 diffusion 모델의 구성 요소(text encoder, scheduler, UNet 또는 DiT, VAE)를 추론을 위해 하나의 클래스로 패키징합니다. [from_pretrained()](/docs/diffusers/v0.43.0/ko/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained)로 로드한 후 파이프라인을 호출합니다. | |
| `__call__()`의 `num_inference_steps`와 같은 인수는 품질과 속도에 영향을 줍니다. 로딩 세부 사항 및 구성 요소 조합에 대해서는 [파이프라인 로드](./using-diffusers/loading)를, 스케줄러 교체에 대해서는 [스케줄러](./using-diffusers/schedulers)를 참조하세요. | |
| … | |
| 생성된 이미지 출력을 액세스하려면 `.images[0]`를 사용하세요. | |
| ```py | |
| import torch | |
| from diffusers import DiffusionPipeline | |
| pipeline = DiffusionPipeline.from_pretrained( | |
| "Qwen/Qwen-Image", dtype=torch.bfloat16, device_map="cuda" # or "mps", "xpu", "cpu" | |
| ) | |
| prompt = """ | |
| cinematic film still of a cat sipping a margarita in a pool in Palm Springs, California | |
| highly detailed, high budget hollywood movie, cinemascope, moody, epic, gorgeous, film grain | |
| """ | |
| pipeline(prompt).images[0] | |
| ``` | |
| `.frames[0]`을 사용하여 생성된 비디오 출력에 액세스하고 [export_to_video()](/docs/diffusers/v0.43.0/ko/api/utilities#diffusers.utils.export_to_video)를 사용하여 비디오를 저장합니다. | |
| ```py | |
| import torch | |
| from diffusers import AutoencoderKLWan, DiffusionPipeline | |
| from diffusers.utils import export_to_video | |
| vae = AutoencoderKLWan.from_pretrained( | |
| "Wan-AI/Wan2.2-T2V-A14B-Diffusers", | |
| subfolder="vae", | |
| dtype=torch.float32 | |
| ) | |
| pipeline = DiffusionPipeline.from_pretrained( | |
| "Wan-AI/Wan2.2-T2V-A14B-Diffusers", | |
| vae=vae, | |
| dtype=torch.bfloat16, | |
| device_map="cuda" # or "mps", "xpu", "cpu" | |
| ) | |
| prompt = """ | |
| Cinematic video of a sleek cat lounging on a colorful inflatable in a crystal-clear turquoise pool in Palm Springs, | |
| sipping a salt-rimmed margarita through a straw. Golden-hour sunlight glows over mid-century modern homes and swaying palms. | |
| Shot in rich Sony a7S III: with moody, glamorous color grading, subtle lens flares, and soft vintage film grain. | |
| Ripples shimmer as a warm desert breeze stirs the water, blending luxury and playful charm in an epic, gorgeously composed frame. | |
| """ | |
| video = pipeline(prompt=prompt, num_frames=81, num_inference_steps=40).frames[0] | |
| export_to_video(video, "output.mp4", fps=16) | |
| ``` | |
| ## LoRA | |
| [LoRA](./tutorials/using_peft_for_inference) 어댑터는 기본 파이프라인 위에 작은 스타일 또는 주체 체크포인트를 추가합니다. [load_lora_weights()](/docs/diffusers/v0.43.0/ko/api/loaders/lora#diffusers.loaders.QwenImageLoraLoaderMixin.load_lora_weights)를 사용하여 하나를 로드합니다. 일부 LoRA는 트리거 구문이 필요합니다. 해당 LoRA의 모델 카드를 확인하세요. | |
| ```py | |
| import torch | |
| from diffusers import DiffusionPipeline | |
| pipeline = DiffusionPipeline.from_pretrained( | |
| "Qwen/Qwen-Image", dtype=torch.bfloat16, device_map="cuda" # or "mps", "xpu", "cpu" | |
| ) | |
| pipeline.load_lora_weights( | |
| "threecrowco/VolkClipartQwen", | |
| weight_name="pytorch_lora_weights.safetensors", | |
| ) | |
| prompt = """ | |
| Volk clipart style drawing of a cat sipping a margarita in a pool in Palm Springs, California, flat colors, bold outlines, simple shapes | |
| """ | |
| pipeline(prompt).images[0] | |
| ``` | |
| ## 양자화 및 최적화 | |
| 대형 모델은 종종 더 적은 메모리 또는 더 높은 속도가 필요합니다. 메모리 내 가중치를 축소하려면 [quantization](./quantization/overview)을 사용하고, 이후 생성을 가속화하려면 [compile_repeated_blocks()](/docs/diffusers/v0.43.0/ko/api/models/overview#diffusers.ModelMixin.compile_repeated_blocks)을 사용하세요. [모델 오프로딩](./optimization/memory#model-offloading) 및 기타 옵션에 대해서는 [Optimize and scale](./stable_diffusion)을 참조하세요. | |
| 메모리 사용량을 줄이려면 bitsandbytes를 사용하여 4비트로 로드하세요. | |
| ```py | |
| import torch | |
| from diffusers import DiffusionPipeline | |
| from diffusers.quantizers import PipelineQuantizationConfig | |
| quant_config = PipelineQuantizationConfig( | |
| quant_backend="bitsandbytes_4bit", | |
| quant_kwargs={"load_in_4bit": True, "bnb_4bit_quant_type": "nf4", "bnb_4bit_compute_dtype": torch.bfloat16}, | |
| components_to_quantize=["transformer", "text_encoder"], | |
| ) | |
| pipeline = DiffusionPipeline.from_pretrained( | |
| "Qwen/Qwen-Image", | |
| dtype=torch.bfloat16, | |
| quantization_config=quant_config, | |
| device_map="cuda" # or "mps", "xpu", "cpu" | |
| ) | |
| prompt = """ | |
| cinematic film still of a cat sipping a margarita in a pool in Palm Springs, California | |
| highly detailed, high budget hollywood movie, cinemascope, moody, epic, gorgeous, film grain | |
| """ | |
| pipeline(prompt).images[0] | |
| ``` | |
| 이후 실행 속도를 높이기 위해 transformer의 반복 블록을 컴파일합니다. 컴파일 후 첫 번째 generate는 콜드 스타트 상태이므로 느립니다. 이후의 generate는 더 빠릅니다. | |
| ```py | |
| import torch | |
| from diffusers import DiffusionPipeline | |
| pipeline = DiffusionPipeline.from_pretrained( | |
| "Qwen/Qwen-Image", dtype=torch.bfloat16, device_map="cuda" # or "mps", "xpu", "cpu" | |
| ) | |
| pipeline.transformer.compile_repeated_blocks(fullgraph=True) | |
| prompt = """ | |
| cinematic film still of a cat sipping a margarita in a pool in Palm Springs, California | |
| highly detailed, high budget hollywood movie, cinemascope, moody, epic, gorgeous, film grain | |
| """ | |
| pipeline(prompt).images[0] | |
| ``` | |
| ## 다음 단계 | |
| - [추론](./using-diffusers/loading) — 파이프라인, 프롬프팅, 어댑터 | |
| - [최적화 및 확장](./stable_diffusion) — 메모리, 속도, 양자화 및 서빙 | |
| - [모듈형 Diffusers](./modular_diffusers/overview) — 조합 가능한 블록과 사용자 정의 파이프라인 | |
| - [학습 및 파인튜닝](./training/overview) — 학습 스크립트 및 어댑터 | |
| - [CLI](./using-diffusers/cli) — 명령줄에서 생성 | |
Xet Storage Details
- Size:
- 7.84 kB
- Xet hash:
- 5663b7a38713675e9ea6aaa72f9955e119441588941be019be5e6aa667110608
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.