Diffusers documentation

DiffusionPipeline에서 가져오기

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

DiffusionPipeline에서 가져오기

DiffusionPipeline에 익숙하고 ModularPipeline을 처음 사용하는 경우, 몇 가지 동작 방식이 다릅니다. quickstart를 진행하기 전에 아래 내용을 참고해 두시기 바랍니다.

  • Loading is lazy and flexible. from_pretrained() builds the pipeline from the repository’s modular_model_index.json without loading any weights. load_components() then loads them, and it doesn’t have to be all at once: by default it loads everything, but you can load only the components you name with names, or the set one workflow needs with workflow. update_components() lets you reuse a component you already have, or one that differs from the repository’s spec. See Loading components and Updating components.
  • ModularPipeline reads a different index, modular_model_index.json, but it also works with a repository that only has a model_index.json, as long as the model has a modular pipeline. The reverse is not true: DiffusionPipeline and the AutoPipeline classes don’t work with a repository that only has a modular_model_index.json.
  • 호출은 파이프라인 상태를 반환합니다. 이 상태에는 중간 값(prompt_embeds, latents, …)도 포함됩니다. output 인수를 사용해 필요한 항목을 요청할 수 있습니다. 예를 들어 output="images" 또는 output=["images", "latents"]처럼 사용할 수 있고, quickstart에서처럼 상태의 속성을 직접 읽을 수도 있습니다. States를 참고하세요.
  • guider 구성 요소에서 Classifier-free guidance가 지원되며, guidance_scale 호출 인수가 아닙니다: pipe.update_components(guider=ClassifierFreeGuidance(guidance_scale=5.0)). guiders 가이드를 참조하세요.
  • callback_on_step_end은 없습니다. 대신, 노이즈 제거 루프에 블록을 삽입하여 기존 콜백 함수를 사용할 수 있습니다. 콜백 가이드의 모듈형 파이프라인을 참고하세요.
  • 파이프라인은 블록의 그래프이며, init_pipeline()로 빌드하기 전에 변경(추출, 삽입, 교체)할 수 있습니다. pipe.blocks는 복사본을 반환하므로 먼저 블록을 편집하세요. 새 워크플로우 구성을 참조하세요.
  • Offloading is handled by a ComponentsManager, which can serve several pipelines that share components. See the ComponentsManager guide.
Update on GitHub