Diffusers documentation

DiffusionPipeline から

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

DiffusionPipeline から

DiffusionPipeline に慣れている方で、ModularPipeline を初めて扱う場合は、いくつか動作が異なります。クイックスタート を進める前に、以下の点をご確認ください。

  • 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"] のように指定するか、クイックスタート にあるように状態の属性を読み取ります。States を参照してください。
  • Classifier-free guidance is supported in the guider component, not a guidance_scale call argument: pipe.update_components(guider=ClassifierFreeGuidance(guidance_scale=5.0)). See the guiders guide.
  • callback_on_step_end は存在しません。ただし、デノイジングループにブロックを挿入して、既存のコールバック関数を使用できます。コールバックガイドの「Modular pipelines」を参照してください。
  • パイプラインはブロックのグラフであり、init_pipeline()でビルドする前に変更(pop、insert、replace)できます。pipe.blocksはコピーを返すため、まずブロックを編集してください。新しいワークフローの作成を参照してください。
  • オフロードは、コンポーネントを共有する複数のパイプラインに対応できるComponentsManagerによって処理されます。ComponentsManager ガイドを参照してください。
Update on GitHub