Diffusers documentation
DiffusionPipeline から
はじめに
推論
拡散パイプラインの使用
アダプターとパーソナライズ
最適化とスケーリング
モジュール型 Diffusers
概要クイックスタートDiffusionPipeline から状態ModularPipelineBlocksSequentialPipelineBlocksLoopSequentialPipelineBlocksAutoPipelineBlocksModularPipelineガイドComponentsManager自動ドキュメント文字列とパラメータのテンプレートカスタムブロックの構築Mellonでのカスタムブロックの使用
学習とファインチューニング
リソース
コントリビュート
API
DiffusionPipeline から
DiffusionPipeline に慣れている方で、ModularPipeline を初めて扱う場合は、いくつか動作が異なります。クイックスタート を進める前に、以下の点をご確認ください。
- Loading is lazy and flexible. from_pretrained() builds the pipeline from the repository’s
modular_model_index.jsonwithout 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 withnames, or the set one workflow needs withworkflow. 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 amodel_index.json, as long as the model has a modular pipeline. The reverse is not true: DiffusionPipeline and theAutoPipelineclasses don’t work with a repository that only has amodular_model_index.json. - 呼び出しはパイプラインの状態を返します。この状態には中間値(
prompt_embeds、latentsなど)も保持されています。output引数で必要なものを指定します。例えばoutput="images"やoutput=["images", "latents"]のように指定するか、クイックスタート にあるように状態の属性を読み取ります。States を参照してください。 - Classifier-free guidance is supported in the
guidercomponent, not aguidance_scalecall 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 ガイドを参照してください。