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 لأول مرة، فإن بعض الأمور تعمل بشكل مختلف. وهي مذكورة هنا حتى تكون على علم بها قبل أن تتابع البدء السريع.

  • 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 يقرأ فهرسًا مختلفًا، modular_model_index.json، لكنه يعمل أيضًا مع مستودع يحتوي فقط على model_index.json، طالما أن النموذج يحتوي على خط أنابيب معياري. والعكس غير صحيح: ففئات DiffusionPipeline وAutoPipeline لا تعمل مع مستودع يحتوي فقط على modular_model_index.json.
  • تُعيد الاستدعاء حالة خط الأنابيب، التي تحتفظ أيضًا بالقيم الوسيطة (prompt_embeds، latents، …). اطلب ما تحتاجه عبر الحجة output، مثل output="images" أو output=["images", "latents"]، أو اقرأ خاصية من الحالة، كما في البدء السريع. راجع الحالات.
  • يُؤمَّن توجيه التصنيف الحر في مكوّن guider، وليس في معامل استدعاء guidance_scale: pipe.update_components(guider=ClassifierFreeGuidance(guidance_scale=5.0)). راجع دليل الموجّهات.
  • لا يوجد callback_on_step_end؛ ومع ذلك، يمكنك إدراج كتلة في حلقة إزالة الضوضاء لاستخدام دوال الاستدعاء الموجودة لديك. راجع خطوط الأنابيب المعيارية في دليل الاستدعاءات.
  • خط الأنابيب هو رسم بياني من الكتل يمكنك تغييرها (إزالة، إدراج، استبدال) قبل بنائها باستخدام init_pipeline()؛ يعيد pipe.blocks نسخة، لذا عدّل الكتل أولاً. راجع تكوين سير عمل جديدة.
  • يتم التعامل مع عملية الإزاحة بواسطة ComponentsManager، والذي يمكنه خدمة عدة خطوط أنابيب تتشارك في المكونات. راجع دليل ComponentsManager.
Update on GitHub