Buckets:
| # | |
| # مرخّص بموجب ترخيص Apache الإصدار 2.0 (المسمى "الترخيص") | |
| # لا يجوز لك استخدام هذا الملف إلا وفقاً لشروط الترخيص. | |
| # يمكنك الحصول على نسخة من الترخيص في | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # ما لم يقتضِ ذلك القانون المعمول به أو ما اتُّفق عليه كتابياً، البرمجيات | |
| # تُوزَّع بموجب الرخصة على أساس "كما هي"، | |
| # بلا أي ضمانات أو شروط من أي نوع، سواء صريحة أو ضمنية. | |
| # راجع الترخيص لمعرفة اللغة المحددة التي تحكم الصلاحيات و | |
| # الشروط المحددة في الترخيص. | |
| --> | |
| # CogVideoX | |
| [CogVideoX](https://huggingface.co/papers/2408.06072) هو نموذج تحويل انتشار كبير - متوفر بإصدارات 2B و 5B من المعاملات - مصمم لتوليد مقاطع فيديو أطول وأكثر اتساقًا من النص. يستخدم هذا نموذج الترميز التلقائي المتغير السببي ثلاثي الأبعاد (3D causal variational autoencoder) لمعالجة بيانات الفيديو بكفاءة أكبر من خلال تقليل طول التسلسل (والحسابات التدريبية المرتبطة به) ومنع الوميض في مقاطع الفيديو المولّدة. كما يحسّن نموذج التحويل "الخبراء" (expert transformer) مع تطبيع الطبقة التكيفي (adaptive LayerNorm) المحاذاة بين النص والفيديو، ويساعد الانتباه الكامل ثلاثي الأبعاد (3D full attention) على التقاط الحركة والزمن بدقة في مقاطع الفيديو المولّدة. | |
| يمكنك العثور على جميع نقاط التفتيش الأصلية لـ CogVideoX ضمن مجموعة [CogVideoX](https://huggingface.co/collections/THUDM/cogvideo-66c08e62f1685a3ade464cce). | |
| > [!TIP] | |
| > انقر على نماذج CogVideoX في الشريط الجانبي الأيمن لمزيد من الأمثلة على مهام توليد الفيديو الأخرى. | |
| يُبيّن المثال أدناه كيفية توليد فيديو مُحسَّن للذاكرة أو لسرعة الاستدلال. | |
| راجع دليل [تقليل استهلاك الذاكرة](../../optimization/memory) لمزيد من التفاصيل حول تقنيات توفير الذاكرة المختلفة. | |
| يتطلب نموذج CogVideoX 5B المُكمَّم أدناه حوالي 16 جيجابايت من ذاكرة الفيديو (VRAM). | |
| ```py | |
| import torch | |
| from diffusers import CogVideoXPipeline, AutoModel, TorchAoConfig | |
| from diffusers.quantizers import PipelineQuantizationConfig | |
| from diffusers.hooks import apply_group_offloading | |
| from diffusers.utils import export_to_video | |
| from torchao.quantization import Int8WeightOnlyConfig | |
| # quantize weights to int8 with torchao | |
| pipeline_quant_config = PipelineQuantizationConfig( | |
| quant_mapping={"transformer": TorchAoConfig(Int8WeightOnlyConfig())} | |
| ) | |
| # fp8 layerwise weight-casting | |
| transformer = AutoModel.from_pretrained( | |
| "THUDM/CogVideoX-5b", | |
| subfolder="transformer", | |
| dtype=torch.bfloat16 | |
| ) | |
| transformer.enable_layerwise_casting( | |
| storage_dtype=torch.float8_e4m3fn, compute_dtype=torch.bfloat16 | |
| ) | |
| pipeline = CogVideoXPipeline.from_pretrained( | |
| "THUDM/CogVideoX-5b", | |
| transformer=transformer, | |
| quantization_config=pipeline_quant_config, | |
| dtype=torch.bfloat16 | |
| ) | |
| pipeline.to("cuda") # or "mps", "xpu", "cpu" | |
| # model-offloading | |
| pipeline.enable_model_cpu_offload() | |
| prompt = """ | |
| A detailed wooden toy ship with intricately carved masts and sails is seen gliding smoothly over a plush, blue carpet that mimics the waves of the sea. | |
| The ship's hull is painted a rich brown, with tiny windows. The carpet, soft and textured, provides a perfect backdrop, resembling an oceanic expanse. | |
| Surrounding the ship are various other toys and children's items, hinting at a playful environment. The scene captures the innocence and imagination of childhood, | |
| with the toy ship's journey symbolizing endless adventures in a whimsical, indoor setting. | |
| """ | |
| video = pipeline( | |
| prompt=prompt, | |
| guidance_scale=6, | |
| num_inference_steps=50 | |
| ).frames[0] | |
| export_to_video(video, "output.mp4", fps=8) | |
| ``` | |
| يكون [التجميع](../../optimization/fp16#torchcompile) بطيئًا في المرة الأولى، لكن الاستدعاءات اللاحقة للخط الأنابيب تكون أسرع. | |
| يبلغ متوسط زمن الاستدلال باستخدام torch.compile على بطاقة 80GB A100 76.27 ثانية، مقارنةً بـ 96.89 ثانية للنموذج غير المُجمَّع. | |
| ```py | |
| import torch | |
| from diffusers import CogVideoXPipeline | |
| from diffusers.utils import export_to_video | |
| pipeline = CogVideoXPipeline.from_pretrained( | |
| "THUDM/CogVideoX-2b", | |
| dtype=torch.float16 | |
| ).to("cuda") # or "mps", "xpu", "cpu" | |
| # torch.compile | |
| pipeline.transformer.to(memory_format=torch.channels_last) | |
| pipeline.transformer = torch.compile( | |
| pipeline.transformer, mode="max-autotune", fullgraph=True | |
| ) | |
| prompt = """ | |
| A detailed wooden toy ship with intricately carved masts and sails is seen gliding smoothly over a plush, blue carpet that mimics the waves of the sea. | |
| The ship's hull is painted a rich brown, with tiny windows. The carpet, soft and textured, provides a perfect backdrop, resembling an oceanic expanse. | |
| Surrounding the ship are various other toys and children's items, hinting at a playful environment. The scene captures the innocence and imagination of childhood, | |
| with the toy ship's journey symbolizing endless adventures in a whimsical, indoor setting. | |
| """ | |
| video = pipeline( | |
| prompt=prompt, | |
| guidance_scale=6, | |
| num_inference_steps=50 | |
| ).frames[0] | |
| export_to_video(video, "output.mp4", fps=8) | |
| ``` | |
| ## ملاحظات | |
| - يدعم CogVideoX نماذج LoRA من خلال [load_lora_weights()](/docs/diffusers/main/ar/api/loaders/lora#diffusers.loaders.CogVideoXLoraLoaderMixin.load_lora_weights). | |
| عرض كود مثال | |
| ```py | |
| import torch | |
| from diffusers import CogVideoXPipeline | |
| from diffusers.hooks import apply_group_offloading | |
| from diffusers.utils import export_to_video | |
| pipeline = CogVideoXPipeline.from_pretrained( | |
| "THUDM/CogVideoX-5b", | |
| dtype=torch.bfloat16 | |
| ) | |
| pipeline.to("cuda") # or "mps", "xpu", "cpu" | |
| # load LoRA weights | |
| pipeline.load_lora_weights("finetrainers/CogVideoX-1.5-crush-smol-v0", adapter_name="crush-lora") | |
| pipeline.set_adapters("crush-lora", 0.9) | |
| # model-offloading | |
| pipeline.enable_model_cpu_offload() | |
| prompt = """ | |
| PIKA_CRUSH A large metal cylinder is seen pressing down on a pile of Oreo cookies, flattening them as if they were under a hydraulic press. | |
| """ | |
| negative_prompt = "inconsistent motion, blurry motion, worse quality, degenerate outputs, deformed outputs" | |
| video = pipeline( | |
| prompt=prompt, | |
| negative_prompt=negative_prompt, | |
| num_frames=81, | |
| height=480, | |
| width=768, | |
| num_inference_steps=50 | |
| ).frames[0] | |
| export_to_video(video, "output.mp4", fps=16) | |
| ``` | |
| - تعمل نقاط التفتيش الخاصة بتحويل النص إلى فيديو (T2V) بشكل أفضل بدقة 1360x768 لأن هذه كانت الدقة التي تم تدريبها عليها مسبقًا. | |
| - تعمل نقاط التفتيش الخاصة بتحويل الصورة إلى فيديو (I2V) مع دقات متعددة. يمكن أن يتراوح العرض بين 768 و1360، لكن يجب أن يكون الارتفاع 758. ويجب أن يكون كل من الارتفاع والعرض قابلين للقسمة على 16. | |
| - يعمل كل من نقاط التفتيش T2V و I2V بشكل أفضل مع 81 و 161 إطارًا. يُوصى بتصدير الفيديو المولّد بمعدل 16 إطارًا في الثانية. | |
| - راجع الجدول أدناه لعرض استهلاك الذاكرة عند تفعيل تقنيات توفير الذاكرة المختلفة. | |
| | طريقة | استهلاك الذاكرة (مُفعّل) | استهلاك الذاكرة (معطّل) | | |
| |---|---|---| | |
| | enable_model_cpu_offload | 19GB | 33GB | | |
| | enable_sequential_cpu_offload | <4GB | ~33GB (سرعة استدلال بطيئة جدًا) | | |
| | enable_tiling | 11 جيجابايت (مع تفعيل enable_model_cpu_offload) | --- | | |
| ## CogVideoXPipeline[[diffusers.CogVideoXPipeline]] | |
| #### diffusers.CogVideoXPipeline[[diffusers.CogVideoXPipeline]] | |
| ```python | |
| diffusers.CogVideoXPipeline(tokenizer: T5Tokenizer, text_encoder: T5EncoderModel, vae: AutoencoderKLCogVideoX, transformer: CogVideoXTransformer3DModel, scheduler: diffusers.schedulers.scheduling_ddim_cogvideox.CogVideoXDDIMScheduler | diffusers.schedulers.scheduling_dpm_cogvideox.CogVideoXDPMScheduler) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox.py#L147) | |
| **المعاملات:** | |
| vae ([AutoencoderKL](/docs/diffusers/main/ar/api/models/autoencoderkl#diffusers.AutoencoderKL)) : نموذج الترميز التحويلي التبايني (VAE) لتشفير وفك تشفير مقاطع الفيديو إلى تمثيلات كامنة ومنها. | |
| text_encoder (`T5EncoderModel`) : مُشفِّر نص ثابت. يستخدم CogVideoX [T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel)؛ وتحديداً النسخة [t5-v1_1-xxl](https://huggingface.co/PixArt-alpha/PixArt-alpha/tree/main/t5-v1_1-xxl). | |
| tokenizer (`T5Tokenizer`) : مُجزِّئ من الفئة [T5Tokenizer](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer). | |
| transformer ([CogVideoXTransformer3DModel](/docs/diffusers/main/ar/api/models/cogvideox_transformer3d#diffusers.CogVideoXTransformer3DModel)) : نموذج `CogVideoXTransformer3DModel` مشروط بالنص لإزالة الضوضاء من كامنات الفيديو المُرمّزة. | |
| scheduler ([SchedulerMixin](/docs/diffusers/main/ar/api/schedulers/overview#diffusers.SchedulerMixin)) : مُجدول يُستخدم بالاقتران مع `transformer` لإزالة الضوضاء من كامنات الفيديو المُرمّزة. | |
| خط أنابيب لتوليد الفيديو من النص باستخدام CogVideoX. | |
| يرث هذا النموذج من [DiffusionPipeline](/docs/diffusers/main/ar/api/pipelines/overview#diffusers.DiffusionPipeline). راجع توثيق الفئة الأصلية لمعرفة الطرق العامة التي تنفذها المكتبة لجميع خطوط الأنابيب (مثل التنزيل أو الحفظ، أو التشغيل على جهاز معين، وما إلى ذلك). | |
| #### __call__[[diffusers.CogVideoXPipeline.__call__]] | |
| ```python | |
| __call__(prompt: str | list[str] | None = None, negative_prompt: str | list[str] | None = None, height: int | None = None, width: int | None = None, num_frames: int | None = None, num_inference_steps: int = 50, timesteps: list[int] | None = None, guidance_scale: float = 6, use_dynamic_cfg: bool = False, num_videos_per_prompt: int = 1, eta: float = 0.0, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.FloatTensor] = None, prompt_embeds: typing.Optional[torch.FloatTensor] = None, negative_prompt_embeds: typing.Optional[torch.FloatTensor] = None, output_type: str = 'pil', return_dict: bool = True, attention_kwargs: dict[str, typing.Any] | None = None, callback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None, callback_on_step_end_tensor_inputs: list[str] = ['latents'], max_sequence_length: int = 226) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox.py#L505) | |
| **المعاملات:** | |
| prompt (`str` أو `list[str]`، *اختياري*) : الأمر أو الأوامر التي تُوجّه توليد الصورة. إذا لم يُعرَّف، يجب تمرير `prompt_embeds` بدلاً من ذلك. | |
| negative_prompt (`str` أو `list[str]`، *اختياري*) : الموجه أو الموجهات التي لا ينبغي توجيه توليد الصورة بها. إذا لم يُعرَّف، يجب تمرير `negative_prompt_embeds` بدلاً من ذلك. يتم تجاهله عند عدم استخدام التوجيه (أي يتم تجاهله إذا كان `guidance_scale` أقل من `1`). | |
| height (`int`، *اختياري*، القيمة الافتراضية هي self.transformer.config.sample_height * self.vae_scale_factor_spatial) : ارتفاع الصورة المولّدة بالبكسلات. يتم ضبطه على 480 افتراضيًا للحصول على أفضل النتائج. | |
| width (`int`، *اختياري*، القيمة الافتراضية هي self.transformer.config.sample_height * self.vae_scale_factor_spatial) : عرض الصورة المولدة بالبكسلات. يتم ضبطه على 720 افتراضيًا للحصول على أفضل النتائج. | |
| num_frames (`int`، القيمة الافتراضية `48`) : عدد الإطارات التي سيتم توليدها. يجب أن يكون قابلاً للقسمة على self.vae_scale_factor_temporal. ستحتوي الفيديو المولّدة على إطار إضافي واحد لأن CogVideoX مشروط بعدد إطارات يساوي (num_seconds * fps + 1) حيث num_seconds تساوي 6 و fps تساوي 8. ومع ذلك، بما أنه يمكن حفظ الفيديوهات بأي معدل إطارات، فإن الشرط الوحيد الذي يجب استيفاءه هو شرط القسمة المذكور أعلاه. | |
| num_inference_steps (`int`، *اختياري*، القيمة الافتراضية 50) : عدد خطوات إزالة الضوضاء. تؤدي زيادة عدد خطوات إزالة الضوضاء عادةً إلى صورة ذات جودة أعلى على حساب بطء الاستدلال. | |
| timesteps (`list[int]`، *اختياري*) : خطوات زمنية مخصصة لاستخدامها في عملية إزالة الضوضاء مع المجدولين الذين يدعمون معامل `timesteps` في طريقة `set_timesteps` الخاصة بهم. إذا لم يُعرَّف، فسيتم استخدام السلوك الافتراضي عند تمرير `num_inference_steps`. يجب أن تكون بترتيب تنازلي. | |
| guidance_scale (`float`، *اختياري*، القيمة الافتراضية 7.0) : مقياس التوجيه كما هو مُعرَّف في [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598). يُعرَّف `guidance_scale` على أنه `w` من المعادلة 2. في [Imagen Paper](https://huggingface.co/papers/2205.11487). يتم تفعيل مقياس التوجيه عن طريق تعيين `guidance_scale > 1`. يشجع مقياس التوجيه الأعلى على توليد صور مرتبطة ارتباطًا وثيقًا بنص `prompt`، وعادةً على حساب انخفاض جودة الصورة. | |
| use_dynamic_cfg (`bool`، *اختياري*، القيمة الافتراضية `False`) : إذا كانت True، تُعدّل مقياس التوجيه ديناميكيًا أثناء الاستدلال. | |
| num_videos_per_prompt (`int`، *اختياري*، القيمة الافتراضية 1) : عدد مقاطع الفيديو التي سيتم توليدها لكل موجه. | |
| eta (`float`، *اختياري*، القيمة الافتراضية 0.0) : يتوافق مع المعامل eta (η) من ورقة [DDIM](https://arxiv.org/abs/2010.02502). ينطبق فقط على [DDIMScheduler](/docs/diffusers/main/ar/api/schedulers/ddim#diffusers.DDIMScheduler)، ويُتجاهل في المجدولين الآخرين. | |
| generator (`torch.Generator` أو `list[torch.Generator]`، *اختياري*) : مولّد واحد أو قائمة من [مولّدات torch](https://pytorch.org/docs/stable/generated/torch.Generator.html) لجعل التوليد حتميًا. | |
| latents (`torch.FloatTensor`، *اختياري*) : كامنات ضجيج مُولّدة مسبقًا، مُستخرجة من توزيع غاوسي، تُستخدم كمدخلات لتوليد الصور. يمكن استخدامها لتعديل نفس التوليد باستخدام أوامر مختلفة. إذا لم تُقدَّم، فسيتم إنشاء كامنات من خلال الاستخراج باستخدام `generator` العشوائي المُقدَّم. | |
| prompt_embeds (`torch.FloatTensor`، *اختياري*) : تمثيلات نصية مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد تمثيلات النص من معامل الإدخال `prompt`. | |
| negative_prompt_embeds (`torch.FloatTensor`، *اختياري*) : تمثيلات نصية سالبة مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد negative_prompt_embeds من معامل الإدخال `negative_prompt`. | |
| output_type (`str`، *اختياري*، القيمة الافتراضية `"pil"`) : صيغة الصورة الناتجة عن عملية التوليد. اختر بين [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` أو `np.array`. | |
| return_dict (`bool`، *اختياري*، القيمة الافتراضية `True`) : ما إذا كان يجب إرجاع `~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput` بدلاً من tuple عادي. | |
| attention_kwargs (`dict`، *اختياري*) : قاموس kwargs يُمرَّر إلى `AttentionProcessor` إذا تم تحديده، كما هو معرَّف تحت `self.processor` في [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py). | |
| callback_on_step_end (`Callable`، *اختياري*) : دالة تُستدعى في نهاية كل خطوة إزالة ضوضاء أثناء الاستدلال. تُستدعى الدالة بالحجج التالية: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. سيتضمن `callback_kwargs` قائمة بجميع المصفوفات كما حددتها `callback_on_step_end_tensor_inputs`. | |
| callback_on_step_end_tensor_inputs (`list`، *اختياري*) : قائمة مدخلات المصفوفات (tensors) لدالة `callback_on_step_end`. سيتم تمرير المصفوفات المحددة في القائمة كحجة `callback_kwargs`. لن تتمكن من تضمين سوى المتغيرات المدرجة في خاصية `._callback_tensor_inputs` لفئة خط الأنابيب (pipeline) الخاص بك. | |
| max_sequence_length (`int`، القيمة الافتراضية `226`) : الحد الأقصى لطول التسلسل في الموجه المُرمَّز. يجب أن يكون متسقًا مع `self.transformer.config.max_text_seq_length` وإلا فقد يؤدي ذلك إلى نتائج غير جيدة. | |
| **يعيد:** [CogVideoXPipelineOutput](/docs/diffusers/main/ar/api/pipelines/cogvideox#diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput) أو `tuple` | |
| [CogVideoXPipelineOutput](/docs/diffusers/main/ar/api/pipelines/cogvideox#diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput) إذا كان `return_dict` هو True، وإلا فسيكون `tuple`. عند إرجاع tuple، يكون العنصر الأول قائمة تحتوي على الصور المولّدة. | |
| الدالة التي تُستدعى عند استدعاء خط الأنابيب للتوليد. | |
| أمثلة: | |
| ```python | |
| >>> import torch | |
| >>> from diffusers import CogVideoXPipeline | |
| >>> from diffusers.utils import export_to_video | |
| >>> # Models: "THUDM/CogVideoX-2b" or "THUDM/CogVideoX-5b" | |
| >>> pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-2b", torch_dtype=torch.float16).to("cuda") | |
| >>> prompt = ( | |
| ... "A panda, dressed in a small, red jacket and a tiny hat, sits on a wooden stool in a serene bamboo forest. " | |
| ... "The panda's fluffy paws strum a miniature acoustic guitar, producing soft, melodic tunes. Nearby, a few other " | |
| ... "pandas gather, watching curiously and some clapping in rhythm. Sunlight filters through the tall bamboo, " | |
| ... "casting a gentle glow on the scene. The panda's face is expressive, showing concentration and joy as it plays. " | |
| ... "The background includes a small, flowing stream and vibrant green foliage, enhancing the peaceful and magical " | |
| ... "atmosphere of this unique musical performance." | |
| ... ) | |
| >>> video = pipe(prompt=prompt, guidance_scale=6, num_inference_steps=50).frames[0] | |
| >>> export_to_video(video, "output.mp4", fps=8) | |
| ``` | |
| #### encode_prompt[[diffusers.CogVideoXPipeline.encode_prompt]] | |
| ```python | |
| encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 226, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox.py#L244) | |
| **المعاملات:** | |
| prompt (`str` أو `list[str]`، *اختياري*) : النص الذي سيتم ترميزه | |
| negative_prompt (`str` أو `list[str]`، *اختياري*) : الموجه أو الموجهات التي لا ينبغي توجيه توليد الصورة بها. إذا لم يُعرَّف، يجب تمرير `negative_prompt_embeds` بدلاً من ذلك. يتم تجاهله عند عدم استخدام التوجيه (أي يتم تجاهله إذا كان `guidance_scale` أقل من `1`). | |
| do_classifier_free_guidance (`bool`، *اختياري*، الافتراضي `True`) : ما إذا كان سيتم استخدام classifier free guidance أم لا. | |
| num_videos_per_prompt (`int`، *اختياري*، القيمة الافتراضية 1) : عدد مقاطع الفيديو التي يجب توليدها لكل موجه. جهاز torch الذي سيتم وضع التضمينات الناتجة عليه | |
| prompt_embeds (`torch.Tensor`، *اختياري*) : تمثيلات نصية مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد تمثيلات النص من معامل الإدخال `prompt`. | |
| negative_prompt_embeds (`torch.Tensor`, *اختياري*) : تمثيلات نصية سالبة مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد negative_prompt_embeds من معامل الإدخال `negative_prompt`. | |
| device : (`torch.device`, *اختياري*): جهاز torch | |
| dtype : (`torch.dtype`, *اختياري*): torch dtype | |
| يقوم بتشفير الموجه إلى حالات مخفية لمشفّر النص. | |
| #### fuse_qkv_projections[[diffusers.CogVideoXPipeline.fuse_qkv_projections]] | |
| ```python | |
| fuse_qkv_projections() | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox.py#L428) | |
| يتيح الإسقاطات المدمجة لـ QKV. | |
| #### unfuse_qkv_projections[[diffusers.CogVideoXPipeline.unfuse_qkv_projections]] | |
| ```python | |
| unfuse_qkv_projections() | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox.py#L433) | |
| تعطيل دمج إسقاط QKV إذا كان مفعلاً. | |
| ## CogVideoXImageToVideoPipeline[[diffusers.CogVideoXImageToVideoPipeline]] | |
| #### diffusers.CogVideoXImageToVideoPipeline[[diffusers.CogVideoXImageToVideoPipeline]] | |
| ```python | |
| diffusers.CogVideoXImageToVideoPipeline(tokenizer: T5Tokenizer, text_encoder: T5EncoderModel, vae: AutoencoderKLCogVideoX, transformer: CogVideoXTransformer3DModel, scheduler: diffusers.schedulers.scheduling_ddim_cogvideox.CogVideoXDDIMScheduler | diffusers.schedulers.scheduling_dpm_cogvideox.CogVideoXDPMScheduler) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_image2video.py#L160) | |
| **المعاملات:** | |
| vae ([AutoencoderKL](/docs/diffusers/main/ar/api/models/autoencoderkl#diffusers.AutoencoderKL)) : نموذج الترميز التحويلي التبايني (VAE) لتشفير وفك تشفير مقاطع الفيديو إلى تمثيلات كامنة ومنها. | |
| text_encoder (`T5EncoderModel`) : مُشفِّر نص ثابت. يستخدم CogVideoX [T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel)؛ وتحديداً النسخة [t5-v1_1-xxl](https://huggingface.co/PixArt-alpha/PixArt-alpha/tree/main/t5-v1_1-xxl). | |
| tokenizer (`T5Tokenizer`) : مُجزِّئ من الفئة [T5Tokenizer](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer). | |
| transformer ([CogVideoXTransformer3DModel](/docs/diffusers/main/ar/api/models/cogvideox_transformer3d#diffusers.CogVideoXTransformer3DModel)) : نموذج `CogVideoXTransformer3DModel` مشروط بالنص لإزالة الضوضاء من كامنات الفيديو المُرمّزة. | |
| scheduler ([SchedulerMixin](/docs/diffusers/main/ar/api/schedulers/overview#diffusers.SchedulerMixin)) : مُجدول يُستخدم بالاقتران مع `transformer` لإزالة الضوضاء من كامنات الفيديو المُرمّزة. | |
| خط أنابيب لتوليد الفيديو من الصور باستخدام CogVideoX. | |
| يرث هذا النموذج من [DiffusionPipeline](/docs/diffusers/main/ar/api/pipelines/overview#diffusers.DiffusionPipeline). راجع توثيق الفئة الأصلية لمعرفة الطرق العامة التي تنفذها المكتبة لجميع خطوط الأنابيب (مثل التنزيل أو الحفظ، أو التشغيل على جهاز معين، وما إلى ذلك). | |
| #### __call__[[diffusers.CogVideoXImageToVideoPipeline.__call__]] | |
| ```python | |
| __call__(image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]], prompt: str | list[str] | None = None, negative_prompt: str | list[str] | None = None, height: int | None = None, width: int | None = None, num_frames: int = 49, num_inference_steps: int = 50, timesteps: list[int] | None = None, guidance_scale: float = 6, use_dynamic_cfg: bool = False, num_videos_per_prompt: int = 1, eta: float = 0.0, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.FloatTensor] = None, prompt_embeds: typing.Optional[torch.FloatTensor] = None, negative_prompt_embeds: typing.Optional[torch.FloatTensor] = None, output_type: str = 'pil', return_dict: bool = True, attention_kwargs: dict[str, typing.Any] | None = None, callback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None, callback_on_step_end_tensor_inputs: list[str] = ['latents'], max_sequence_length: int = 226) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_image2video.py#L598) | |
| **المعاملات:** | |
| image (`PipelineImageInput`) : الصورة المدخلة التي تُشترط عليها عملية التوليد. يجب أن تكون صورة، أو قائمة من الصور، أو `torch.Tensor`. | |
| prompt (`str` أو `list[str]`، *اختياري*) : الأمر أو الأوامر التي تُوجّه توليد الصورة. إذا لم يُعرَّف، يجب تمرير `prompt_embeds` بدلاً من ذلك. | |
| negative_prompt (`str` أو `list[str]`، *اختياري*) : الموجه أو الموجهات التي لا ينبغي توجيه توليد الصورة بها. إذا لم يُعرَّف، يجب تمرير `negative_prompt_embeds` بدلاً من ذلك. يتم تجاهله عند عدم استخدام التوجيه (أي يتم تجاهله إذا كان `guidance_scale` أقل من `1`). | |
| height (`int`، *اختياري*، القيمة الافتراضية هي self.transformer.config.sample_height * self.vae_scale_factor_spatial) : ارتفاع الصورة المولّدة بالبكسلات. يتم ضبطه على 480 افتراضيًا للحصول على أفضل النتائج. | |
| width (`int`، *اختياري*، القيمة الافتراضية هي self.transformer.config.sample_height * self.vae_scale_factor_spatial) : عرض الصورة المولدة بالبكسلات. يتم ضبطه على 720 افتراضيًا للحصول على أفضل النتائج. | |
| num_frames (`int`، القيمة الافتراضية `48`) : عدد الإطارات التي سيتم توليدها. يجب أن يكون قابلاً للقسمة على self.vae_scale_factor_temporal. ستحتوي الفيديو المولّدة على إطار إضافي واحد لأن CogVideoX مشروط بعدد إطارات يساوي (num_seconds * fps + 1) حيث num_seconds تساوي 6 و fps تساوي 8. ومع ذلك، بما أنه يمكن حفظ الفيديوهات بأي معدل إطارات، فإن الشرط الوحيد الذي يجب استيفاءه هو شرط القسمة المذكور أعلاه. | |
| num_inference_steps (`int`، *اختياري*، القيمة الافتراضية 50) : عدد خطوات إزالة الضوضاء. تؤدي زيادة عدد خطوات إزالة الضوضاء عادةً إلى صورة ذات جودة أعلى على حساب بطء الاستدلال. | |
| timesteps (`list[int]`، *اختياري*) : خطوات زمنية مخصصة لاستخدامها في عملية إزالة الضوضاء مع المجدولين الذين يدعمون معامل `timesteps` في طريقة `set_timesteps` الخاصة بهم. إذا لم يُعرَّف، فسيتم استخدام السلوك الافتراضي عند تمرير `num_inference_steps`. يجب أن تكون بترتيب تنازلي. | |
| guidance_scale (`float`، *اختياري*، القيمة الافتراضية 7.0) : مقياس التوجيه كما هو مُعرَّف في [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598). يُعرَّف `guidance_scale` على أنه `w` من المعادلة 2. في [Imagen Paper](https://huggingface.co/papers/2205.11487). يتم تفعيل مقياس التوجيه عن طريق تعيين `guidance_scale > 1`. يشجع مقياس التوجيه الأعلى على توليد صور مرتبطة ارتباطًا وثيقًا بنص `prompt`، وعادةً على حساب انخفاض جودة الصورة. | |
| use_dynamic_cfg (`bool`، *اختياري*، القيمة الافتراضية `False`) : إذا كانت True، تُعدّل مقياس التوجيه ديناميكيًا أثناء الاستدلال. | |
| num_videos_per_prompt (`int`، *اختياري*، القيمة الافتراضية 1) : عدد مقاطع الفيديو التي سيتم توليدها لكل موجه. | |
| eta (`float`، *اختياري*، القيمة الافتراضية 0.0) : يتوافق مع المعامل eta (η) من ورقة [DDIM](https://arxiv.org/abs/2010.02502). ينطبق فقط على [DDIMScheduler](/docs/diffusers/main/ar/api/schedulers/ddim#diffusers.DDIMScheduler)، ويُتجاهل في المجدولين الآخرين. | |
| generator (`torch.Generator` أو `list[torch.Generator]`، *اختياري*) : مولّد واحد أو قائمة من [مولّدات torch](https://pytorch.org/docs/stable/generated/torch.Generator.html) لجعل التوليد حتميًا. | |
| latents (`torch.FloatTensor`، *اختياري*) : كامنات ضجيج مُولّدة مسبقًا، مُستخرجة من توزيع غاوسي، تُستخدم كمدخلات لتوليد الصور. يمكن استخدامها لتعديل نفس التوليد باستخدام أوامر مختلفة. إذا لم تُقدَّم، فسيتم إنشاء كامنات من خلال الاستخراج باستخدام `generator` العشوائي المُقدَّم. | |
| prompt_embeds (`torch.FloatTensor`، *اختياري*) : تمثيلات نصية مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد تمثيلات النص من معامل الإدخال `prompt`. | |
| negative_prompt_embeds (`torch.FloatTensor`، *اختياري*) : تمثيلات نصية سالبة مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد negative_prompt_embeds من معامل الإدخال `negative_prompt`. | |
| output_type (`str`، *اختياري*، القيمة الافتراضية `"pil"`) : صيغة الصورة الناتجة عن عملية التوليد. اختر بين [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` أو `np.array`. | |
| return_dict (`bool`، *اختياري*، القيمة الافتراضية `True`) : ما إذا كان يجب إرجاع `~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput` بدلاً من tuple عادي. | |
| attention_kwargs (`dict`، *اختياري*) : قاموس kwargs يُمرَّر إلى `AttentionProcessor` إذا تم تحديده، كما هو معرَّف تحت `self.processor` في [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py). | |
| callback_on_step_end (`Callable`، *اختياري*) : دالة تُستدعى في نهاية كل خطوة إزالة ضوضاء أثناء الاستدلال. تُستدعى الدالة بالحجج التالية: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. سيتضمن `callback_kwargs` قائمة بجميع المصفوفات كما حددتها `callback_on_step_end_tensor_inputs`. | |
| callback_on_step_end_tensor_inputs (`list`، *اختياري*) : قائمة مدخلات المصفوفات (tensors) لدالة `callback_on_step_end`. سيتم تمرير المصفوفات المحددة في القائمة كحجة `callback_kwargs`. لن تتمكن من تضمين سوى المتغيرات المدرجة في خاصية `._callback_tensor_inputs` لفئة خط الأنابيب (pipeline) الخاص بك. | |
| max_sequence_length (`int`، القيمة الافتراضية `226`) : الحد الأقصى لطول التسلسل في الموجه المُرمَّز. يجب أن يكون متسقًا مع `self.transformer.config.max_text_seq_length` وإلا فقد يؤدي ذلك إلى نتائج غير جيدة. | |
| **يعيد:** [CogVideoXPipelineOutput](/docs/diffusers/main/ar/api/pipelines/cogvideox#diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput) أو `tuple` | |
| [CogVideoXPipelineOutput](/docs/diffusers/main/ar/api/pipelines/cogvideox#diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput) إذا كان `return_dict` هو True، وإلا فسيكون `tuple`. عند إرجاع tuple، يكون العنصر الأول قائمة تحتوي على الصور المولّدة. | |
| الدالة التي تُستدعى عند استدعاء خط الأنابيب للتوليد. | |
| أمثلة: | |
| ```py | |
| >>> import torch | |
| >>> from diffusers import CogVideoXImageToVideoPipeline | |
| >>> from diffusers.utils import export_to_video, load_image | |
| >>> pipe = CogVideoXImageToVideoPipeline.from_pretrained("THUDM/CogVideoX-5b-I2V", torch_dtype=torch.bfloat16) | |
| >>> pipe.to("cuda") | |
| >>> prompt = "An astronaut hatching from an egg, on the surface of the moon, the darkness and depth of space realised in the background. High quality, ultrarealistic detail and breath-taking movie-like camera shot." | |
| >>> image = load_image( | |
| ... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg" | |
| ... ) | |
| >>> video = pipe(image, prompt, use_dynamic_cfg=True) | |
| >>> export_to_video(video.frames[0], "output.mp4", fps=8) | |
| ``` | |
| #### encode_prompt[[diffusers.CogVideoXImageToVideoPipeline.encode_prompt]] | |
| ```python | |
| encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 226, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_image2video.py#L263) | |
| **المعاملات:** | |
| prompt (`str` أو `list[str]`، *اختياري*) : النص الذي سيتم ترميزه | |
| negative_prompt (`str` أو `list[str]`، *اختياري*) : الموجه أو الموجهات التي لا ينبغي توجيه توليد الصورة بها. إذا لم يُعرَّف، يجب تمرير `negative_prompt_embeds` بدلاً من ذلك. يتم تجاهله عند عدم استخدام التوجيه (أي يتم تجاهله إذا كان `guidance_scale` أقل من `1`). | |
| do_classifier_free_guidance (`bool`، *اختياري*، الافتراضي `True`) : ما إذا كان سيتم استخدام classifier free guidance أم لا. | |
| num_videos_per_prompt (`int`، *اختياري*، القيمة الافتراضية 1) : عدد مقاطع الفيديو التي يجب توليدها لكل موجه. جهاز torch الذي سيتم وضع التضمينات الناتجة عليه | |
| prompt_embeds (`torch.Tensor`، *اختياري*) : تمثيلات نصية مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد تمثيلات النص من معامل الإدخال `prompt`. | |
| negative_prompt_embeds (`torch.Tensor`, *اختياري*) : تمثيلات نصية سالبة مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد negative_prompt_embeds من معامل الإدخال `negative_prompt`. | |
| device : (`torch.device`, *اختياري*): جهاز torch | |
| dtype : (`torch.dtype`, *اختياري*): torch dtype | |
| يقوم بتشفير الموجه إلى حالات مخفية لمشفّر النص. | |
| #### fuse_qkv_projections[[diffusers.CogVideoXImageToVideoPipeline.fuse_qkv_projections]] | |
| ```python | |
| fuse_qkv_projections() | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_image2video.py#L519) | |
| يتيح الإسقاطات المدمجة لـ QKV. | |
| #### unfuse_qkv_projections[[diffusers.CogVideoXImageToVideoPipeline.unfuse_qkv_projections]] | |
| ```python | |
| unfuse_qkv_projections() | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_image2video.py#L525) | |
| تعطيل دمج إسقاط QKV إذا كان مفعلاً. | |
| ## CogVideoXVideoToVideoPipeline[[diffusers.CogVideoXVideoToVideoPipeline]] | |
| #### diffusers.CogVideoXVideoToVideoPipeline[[diffusers.CogVideoXVideoToVideoPipeline]] | |
| ```python | |
| diffusers.CogVideoXVideoToVideoPipeline(tokenizer: T5Tokenizer, text_encoder: T5EncoderModel, vae: AutoencoderKLCogVideoX, transformer: CogVideoXTransformer3DModel, scheduler: diffusers.schedulers.scheduling_ddim_cogvideox.CogVideoXDDIMScheduler | diffusers.schedulers.scheduling_dpm_cogvideox.CogVideoXDPMScheduler) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_video2video.py#L169) | |
| **المعاملات:** | |
| vae ([AutoencoderKL](/docs/diffusers/main/ar/api/models/autoencoderkl#diffusers.AutoencoderKL)) : نموذج الترميز التحويلي التبايني (VAE) لتشفير وفك تشفير مقاطع الفيديو إلى تمثيلات كامنة ومنها. | |
| text_encoder (`T5EncoderModel`) : مُشفِّر نص ثابت. يستخدم CogVideoX [T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel)؛ وتحديداً النسخة [t5-v1_1-xxl](https://huggingface.co/PixArt-alpha/PixArt-alpha/tree/main/t5-v1_1-xxl). | |
| tokenizer (`T5Tokenizer`) : مُجزِّئ من الفئة [T5Tokenizer](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer). | |
| transformer ([CogVideoXTransformer3DModel](/docs/diffusers/main/ar/api/models/cogvideox_transformer3d#diffusers.CogVideoXTransformer3DModel)) : نموذج `CogVideoXTransformer3DModel` مشروط بالنص لإزالة الضوضاء من كامنات الفيديو المُرمّزة. | |
| scheduler ([SchedulerMixin](/docs/diffusers/main/ar/api/schedulers/overview#diffusers.SchedulerMixin)) : مُجدول يُستخدم بالاقتران مع `transformer` لإزالة الضوضاء من كامنات الفيديو المُرمّزة. | |
| خط أنابيب لتوليد فيديو من فيديو باستخدام CogVideoX. | |
| يرث هذا النموذج من [DiffusionPipeline](/docs/diffusers/main/ar/api/pipelines/overview#diffusers.DiffusionPipeline). راجع توثيق الفئة الأصلية لمعرفة الطرق العامة التي تنفذها المكتبة لجميع خطوط الأنابيب (مثل التنزيل أو الحفظ، أو التشغيل على جهاز معين، وما إلى ذلك). | |
| #### __call__[[diffusers.CogVideoXVideoToVideoPipeline.__call__]] | |
| ```python | |
| __call__(video: list[PIL.Image.Image] = None, prompt: str | list[str] | None = None, negative_prompt: str | list[str] | None = None, height: int | None = None, width: int | None = None, num_inference_steps: int = 50, timesteps: list[int] | None = None, strength: float = 0.8, guidance_scale: float = 6, use_dynamic_cfg: bool = False, num_videos_per_prompt: int = 1, eta: float = 0.0, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.FloatTensor] = None, prompt_embeds: typing.Optional[torch.FloatTensor] = None, negative_prompt_embeds: typing.Optional[torch.FloatTensor] = None, output_type: str = 'pil', return_dict: bool = True, attention_kwargs: dict[str, typing.Any] | None = None, callback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None, callback_on_step_end_tensor_inputs: list[str] = ['latents'], max_sequence_length: int = 226) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_video2video.py#L575) | |
| **المعاملات:** | |
| video (`list[PIL.Image.Image]`) : الفيديو المُدخل الذي تُشترط عليه عملية التوليد. يجب أن يكون قائمةً من الصور/الإطارات الخاصة بالفيديو. | |
| prompt (`str` أو `list[str]`، *اختياري*) : الأمر أو الأوامر التي تُوجّه توليد الصورة. إذا لم يُعرَّف، يجب تمرير `prompt_embeds` بدلاً من ذلك. | |
| negative_prompt (`str` أو `list[str]`، *اختياري*) : الموجه أو الموجهات التي لا ينبغي توجيه توليد الصورة بها. إذا لم يُعرَّف، يجب تمرير `negative_prompt_embeds` بدلاً من ذلك. يتم تجاهله عند عدم استخدام التوجيه (أي يتم تجاهله إذا كان `guidance_scale` أقل من `1`). | |
| height (`int`، *اختياري*، القيمة الافتراضية هي self.transformer.config.sample_height * self.vae_scale_factor_spatial) : ارتفاع الصورة المولّدة بالبكسلات. يتم ضبطه على 480 افتراضيًا للحصول على أفضل النتائج. | |
| width (`int`، *اختياري*، القيمة الافتراضية هي self.transformer.config.sample_height * self.vae_scale_factor_spatial) : عرض الصورة المولدة بالبكسلات. يتم ضبطه على 720 افتراضيًا للحصول على أفضل النتائج. | |
| num_inference_steps (`int`، *اختياري*، القيمة الافتراضية 50) : عدد خطوات إزالة الضوضاء. تؤدي زيادة عدد خطوات إزالة الضوضاء عادةً إلى صورة ذات جودة أعلى على حساب بطء الاستدلال. | |
| timesteps (`list[int]`، *اختياري*) : خطوات زمنية مخصصة لاستخدامها في عملية إزالة الضوضاء مع المجدولين الذين يدعمون معامل `timesteps` في طريقة `set_timesteps` الخاصة بهم. إذا لم يُعرَّف، فسيتم استخدام السلوك الافتراضي عند تمرير `num_inference_steps`. يجب أن تكون بترتيب تنازلي. | |
| strength (`float`، *اختياري*، القيمة الافتراضية 0.8) : كلما زادت القوة، زادت الفروق بين الفيديو الأصلي والفيديو المولّد. | |
| guidance_scale (`float`، *اختياري*، القيمة الافتراضية 7.0) : مقياس التوجيه كما هو مُعرَّف في [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598). يُعرَّف `guidance_scale` على أنه `w` من المعادلة 2. في [Imagen Paper](https://huggingface.co/papers/2205.11487). يتم تفعيل مقياس التوجيه عن طريق تعيين `guidance_scale > 1`. يشجع مقياس التوجيه الأعلى على توليد صور مرتبطة ارتباطًا وثيقًا بنص `prompt`، وعادةً على حساب انخفاض جودة الصورة. | |
| use_dynamic_cfg (`bool`، *اختياري*، القيمة الافتراضية `False`) : إذا كانت True، تُعدّل مقياس التوجيه ديناميكيًا أثناء الاستدلال. | |
| num_videos_per_prompt (`int`، *اختياري*، القيمة الافتراضية 1) : عدد مقاطع الفيديو التي سيتم توليدها لكل موجه. | |
| eta (`float`، *اختياري*، القيمة الافتراضية 0.0) : يتوافق مع المعامل eta (η) من ورقة [DDIM](https://arxiv.org/abs/2010.02502). ينطبق فقط على [DDIMScheduler](/docs/diffusers/main/ar/api/schedulers/ddim#diffusers.DDIMScheduler)، ويُتجاهل في المجدولين الآخرين. | |
| generator (`torch.Generator` أو `list[torch.Generator]`، *اختياري*) : مولّد واحد أو قائمة من [مولّدات torch](https://pytorch.org/docs/stable/generated/torch.Generator.html) لجعل التوليد حتميًا. | |
| latents (`torch.FloatTensor`، *اختياري*) : كامنات ضجيج مُولّدة مسبقًا، مُستخرجة من توزيع غاوسي، تُستخدم كمدخلات لتوليد الصور. يمكن استخدامها لتعديل نفس التوليد باستخدام أوامر مختلفة. إذا لم تُقدَّم، فسيتم إنشاء كامنات من خلال الاستخراج باستخدام `generator` العشوائي المُقدَّم. | |
| prompt_embeds (`torch.FloatTensor`، *اختياري*) : تمثيلات نصية مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد تمثيلات النص من معامل الإدخال `prompt`. | |
| negative_prompt_embeds (`torch.FloatTensor`، *اختياري*) : تمثيلات نصية سالبة مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد negative_prompt_embeds من معامل الإدخال `negative_prompt`. | |
| output_type (`str`، *اختياري*، القيمة الافتراضية `"pil"`) : صيغة الصورة الناتجة عن عملية التوليد. اختر بين [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` أو `np.array`. | |
| return_dict (`bool`، *اختياري*، القيمة الافتراضية `True`) : ما إذا كان يجب إرجاع `~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput` بدلاً من tuple عادي. | |
| attention_kwargs (`dict`، *اختياري*) : قاموس kwargs يُمرَّر إلى `AttentionProcessor` إذا تم تحديده، كما هو معرَّف تحت `self.processor` في [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py). | |
| callback_on_step_end (`Callable`، *اختياري*) : دالة تُستدعى في نهاية كل خطوة إزالة ضوضاء أثناء الاستدلال. تُستدعى الدالة بالحجج التالية: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. سيتضمن `callback_kwargs` قائمة بجميع المصفوفات كما حددتها `callback_on_step_end_tensor_inputs`. | |
| callback_on_step_end_tensor_inputs (`list`، *اختياري*) : قائمة مدخلات المصفوفات (tensors) لدالة `callback_on_step_end`. سيتم تمرير المصفوفات المحددة في القائمة كحجة `callback_kwargs`. لن تتمكن من تضمين سوى المتغيرات المدرجة في خاصية `._callback_tensor_inputs` لفئة خط الأنابيب (pipeline) الخاص بك. | |
| max_sequence_length (`int`، القيمة الافتراضية `226`) : الحد الأقصى لطول التسلسل في الموجه المُرمَّز. يجب أن يكون متسقًا مع `self.transformer.config.max_text_seq_length` وإلا فقد يؤدي ذلك إلى نتائج غير جيدة. | |
| **يعيد:** [CogVideoXPipelineOutput](/docs/diffusers/main/ar/api/pipelines/cogvideox#diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput) أو `tuple` | |
| [CogVideoXPipelineOutput](/docs/diffusers/main/ar/api/pipelines/cogvideox#diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput) إذا كان `return_dict` هو True، وإلا فسيكون `tuple`. عند إرجاع tuple، يكون العنصر الأول قائمة تحتوي على الصور المولّدة. | |
| الدالة التي تُستدعى عند استدعاء خط الأنابيب للتوليد. | |
| أمثلة: | |
| ```python | |
| >>> import torch | |
| >>> from diffusers import CogVideoXDPMScheduler, CogVideoXVideoToVideoPipeline | |
| >>> from diffusers.utils import export_to_video, load_video | |
| >>> # Models: "THUDM/CogVideoX-2b" or "THUDM/CogVideoX-5b" | |
| >>> pipe = CogVideoXVideoToVideoPipeline.from_pretrained("THUDM/CogVideoX-5b", torch_dtype=torch.bfloat16) | |
| >>> pipe.to("cuda") | |
| >>> pipe.scheduler = CogVideoXDPMScheduler.from_config(pipe.scheduler.config) | |
| >>> input_video = load_video( | |
| ... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/hiker.mp4" | |
| ... ) | |
| >>> prompt = ( | |
| ... "An astronaut stands triumphantly at the peak of a towering mountain. Panorama of rugged peaks and " | |
| ... "valleys. Very futuristic vibe and animated aesthetic. Highlights of purple and golden colors in " | |
| ... "the scene. The sky is looks like an animated/cartoonish dream of galaxies, nebulae, stars, planets, " | |
| ... "moons, but the remainder of the scene is mostly realistic." | |
| ... ) | |
| >>> video = pipe( | |
| ... video=input_video, prompt=prompt, strength=0.8, guidance_scale=6, num_inference_steps=50 | |
| ... ).frames[0] | |
| >>> export_to_video(video, "output.mp4", fps=8) | |
| ``` | |
| #### encode_prompt[[diffusers.CogVideoXVideoToVideoPipeline.encode_prompt]] | |
| ```python | |
| encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 226, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_video2video.py#L269) | |
| **المعاملات:** | |
| prompt (`str` أو `list[str]`، *اختياري*) : النص الذي سيتم ترميزه | |
| negative_prompt (`str` أو `list[str]`، *اختياري*) : الموجه أو الموجهات التي لا ينبغي توجيه توليد الصورة بها. إذا لم يُعرَّف، يجب تمرير `negative_prompt_embeds` بدلاً من ذلك. يتم تجاهله عند عدم استخدام التوجيه (أي يتم تجاهله إذا كان `guidance_scale` أقل من `1`). | |
| do_classifier_free_guidance (`bool`، *اختياري*، الافتراضي `True`) : ما إذا كان سيتم استخدام classifier free guidance أم لا. | |
| num_videos_per_prompt (`int`، *اختياري*، القيمة الافتراضية 1) : عدد مقاطع الفيديو التي يجب توليدها لكل موجه. جهاز torch الذي سيتم وضع التضمينات الناتجة عليه | |
| prompt_embeds (`torch.Tensor`، *اختياري*) : تمثيلات نصية مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد تمثيلات النص من معامل الإدخال `prompt`. | |
| negative_prompt_embeds (`torch.Tensor`, *اختياري*) : تمثيلات نصية سالبة مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد negative_prompt_embeds من معامل الإدخال `negative_prompt`. | |
| device : (`torch.device`, *اختياري*): جهاز torch | |
| dtype : (`torch.dtype`, *اختياري*): torch dtype | |
| يقوم بتشفير الموجه إلى حالات مخفية لمشفّر النص. | |
| #### fuse_qkv_projections[[diffusers.CogVideoXVideoToVideoPipeline.fuse_qkv_projections]] | |
| ```python | |
| fuse_qkv_projections() | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_video2video.py#L496) | |
| يتيح الإسقاطات المدمجة لـ QKV. | |
| #### unfuse_qkv_projections[[diffusers.CogVideoXVideoToVideoPipeline.unfuse_qkv_projections]] | |
| ```python | |
| unfuse_qkv_projections() | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_video2video.py#L502) | |
| تعطيل دمج إسقاط QKV إذا كان مفعلاً. | |
| ## CogVideoXFunControlPipeline[[diffusers.CogVideoXFunControlPipeline]] | |
| #### diffusers.CogVideoXFunControlPipeline[[diffusers.CogVideoXFunControlPipeline]] | |
| ```python | |
| diffusers.CogVideoXFunControlPipeline(tokenizer: T5Tokenizer, text_encoder: T5EncoderModel, vae: AutoencoderKLCogVideoX, transformer: CogVideoXTransformer3DModel, scheduler: KarrasDiffusionSchedulers) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_fun_control.py#L154) | |
| **المعاملات:** | |
| vae ([AutoencoderKL](/docs/diffusers/main/ar/api/models/autoencoderkl#diffusers.AutoencoderKL)) : نموذج الترميز التحويلي التبايني (VAE) لتشفير وفك تشفير مقاطع الفيديو إلى تمثيلات كامنة ومنها. | |
| text_encoder (`T5EncoderModel`) : مُشفِّر نص ثابت. يستخدم CogVideoX [T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel)؛ وتحديداً النسخة [t5-v1_1-xxl](https://huggingface.co/PixArt-alpha/PixArt-alpha/tree/main/t5-v1_1-xxl). | |
| tokenizer (`T5Tokenizer`) : مُجزِّئ من الفئة [T5Tokenizer](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer). | |
| transformer ([CogVideoXTransformer3DModel](/docs/diffusers/main/ar/api/models/cogvideox_transformer3d#diffusers.CogVideoXTransformer3DModel)) : نموذج `CogVideoXTransformer3DModel` مشروط بالنص لإزالة الضوضاء من كامنات الفيديو المُرمّزة. | |
| scheduler ([SchedulerMixin](/docs/diffusers/main/ar/api/schedulers/overview#diffusers.SchedulerMixin)) : مُجدول يُستخدم بالاقتران مع `transformer` لإزالة الضوضاء من كامنات الفيديو المُرمّزة. | |
| خط أنابيب لتوليد فيديو من نص مع تحكّم باستخدام CogVideoX Fun. | |
| يرث هذا النموذج من [DiffusionPipeline](/docs/diffusers/main/ar/api/pipelines/overview#diffusers.DiffusionPipeline). راجع توثيق الفئة الأصلية لمعرفة الطرق العامة التي تنفذها المكتبة لجميع خطوط الأنابيب (مثل التنزيل أو الحفظ، أو التشغيل على جهاز معين، وما إلى ذلك). | |
| #### __call__[[diffusers.CogVideoXFunControlPipeline.__call__]] | |
| ```python | |
| __call__(prompt: str | list[str] | None = None, negative_prompt: str | list[str] | None = None, control_video: list[PIL.Image.Image] | None = None, height: int | None = None, width: int | None = None, num_inference_steps: int = 50, timesteps: list[int] | None = None, guidance_scale: float = 6, use_dynamic_cfg: bool = False, num_videos_per_prompt: int = 1, eta: float = 0.0, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, control_video_latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, output_type: str = 'pil', return_dict: bool = True, attention_kwargs: dict[str, typing.Any] | None = None, callback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None, callback_on_step_end_tensor_inputs: list[str] = ['latents'], max_sequence_length: int = 226) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_fun_control.py#L551) | |
| **المعاملات:** | |
| prompt (`str` أو `list[str]`، *اختياري*) : الأمر أو الأوامر التي تُوجّه توليد الصورة. إذا لم يُعرَّف، يجب تمرير `prompt_embeds` بدلاً من ذلك. | |
| negative_prompt (`str` أو `list[str]`، *اختياري*) : الموجه أو الموجهات التي لا ينبغي توجيه توليد الصورة بها. إذا لم يُعرَّف، يجب تمرير `negative_prompt_embeds` بدلاً من ذلك. يتم تجاهله عند عدم استخدام التوجيه (أي يتم تجاهله إذا كان `guidance_scale` أقل من `1`). | |
| control_video (`list[PIL.Image.Image]`) : فيديو التحكم الذي يُشترط عليه التوليد. يجب أن يكون قائمة من الصور/الإطارات للفيديو. إذا لم يُقدَّم، فيجب تقديم `control_video_latents`. | |
| height (`int`، *اختياري*، القيمة الافتراضية هي self.transformer.config.sample_height * self.vae_scale_factor_spatial) : ارتفاع الصورة المولّدة بالبكسلات. يتم ضبطه على 480 افتراضيًا للحصول على أفضل النتائج. | |
| width (`int`، *اختياري*، القيمة الافتراضية هي self.transformer.config.sample_height * self.vae_scale_factor_spatial) : عرض الصورة المولدة بالبكسلات. يتم ضبطه على 720 افتراضيًا للحصول على أفضل النتائج. | |
| num_inference_steps (`int`، *اختياري*، القيمة الافتراضية 50) : عدد خطوات إزالة الضوضاء. تؤدي زيادة عدد خطوات إزالة الضوضاء عادةً إلى صورة ذات جودة أعلى على حساب بطء الاستدلال. | |
| timesteps (`list[int]`، *اختياري*) : خطوات زمنية مخصصة لاستخدامها في عملية إزالة الضوضاء مع المجدولين الذين يدعمون معامل `timesteps` في طريقة `set_timesteps` الخاصة بهم. إذا لم يُعرَّف، فسيتم استخدام السلوك الافتراضي عند تمرير `num_inference_steps`. يجب أن تكون بترتيب تنازلي. | |
| guidance_scale (`float`، *اختياري*، القيمة الافتراضية 6.0) : مقياس التوجيه كما هو مُعرَّف في [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598). يُعرَّف `guidance_scale` على أنه `w` من المعادلة 2. في [Imagen Paper](https://huggingface.co/papers/2205.11487). يتم تفعيل مقياس التوجيه عن طريق تعيين `guidance_scale > 1`. يشجع مقياس التوجيه الأعلى على توليد صور مرتبطة ارتباطًا وثيقًا بنص `prompt`، وعادةً على حساب انخفاض جودة الصورة. | |
| use_dynamic_cfg (`bool`، *اختياري*، القيمة الافتراضية `False`) : إذا كانت True، تُعدّل مقياس التوجيه ديناميكيًا أثناء الاستدلال. | |
| num_videos_per_prompt (`int`، *اختياري*، القيمة الافتراضية 1) : عدد مقاطع الفيديو التي سيتم توليدها لكل موجه. | |
| eta (`float`، *اختياري*، القيمة الافتراضية 0.0) : يتوافق مع المعامل eta (η) من ورقة [DDIM](https://arxiv.org/abs/2010.02502). ينطبق فقط على [DDIMScheduler](/docs/diffusers/main/ar/api/schedulers/ddim#diffusers.DDIMScheduler)، ويُتجاهل في المجدولين الآخرين. | |
| generator (`torch.Generator` أو `list[torch.Generator]`، *اختياري*) : مولّد واحد أو قائمة من [مولّدات torch](https://pytorch.org/docs/stable/generated/torch.Generator.html) لجعل التوليد حتميًا. | |
| latents (`torch.Tensor`، *اختياري*) : كامنات ضجيج مُولّدة مسبقًا، مُستخرجة من توزيع غاوسي، تُستخدم كمدخلات لتوليد الفيديو. يمكن استخدامها لتعديل نفس التوليد باستخدام أوامر مختلفة. إذا لم تُقدَّم، سيتم توليد كامنات من خلال الاستخراج باستخدام `generator` العشوائي المُقدَّم. | |
| control_video_latents (`torch.Tensor`، *اختياري*) : كامنات تحكم مُولّدة مسبقًا، مُستخرجة من توزيع غاوسي، تُستخدم كمدخلات لتوليد الفيديو المُتحكَّم به. إذا لم تُقدَّم، يجب تقديم `control_video`. | |
| prompt_embeds (`torch.Tensor`، *اختياري*) : تمثيلات نصية مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد تمثيلات النص من معامل الإدخال `prompt`. | |
| negative_prompt_embeds (`torch.Tensor`, *اختياري*) : تمثيلات نصية سالبة مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد negative_prompt_embeds من معامل الإدخال `negative_prompt`. | |
| output_type (`str`، *اختياري*، القيمة الافتراضية `"pil"`) : صيغة الصورة الناتجة عن عملية التوليد. اختر بين [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` أو `np.array`. | |
| return_dict (`bool`، *اختياري*، القيمة الافتراضية `True`) : ما إذا كان يجب إرجاع `~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput` بدلاً من tuple عادي. | |
| attention_kwargs (`dict`، *اختياري*) : قاموس kwargs يُمرَّر إلى `AttentionProcessor` إذا تم تحديده، كما هو معرَّف تحت `self.processor` في [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py). | |
| callback_on_step_end (`Callable`، *اختياري*) : دالة تُستدعى في نهاية كل خطوة إزالة ضوضاء أثناء الاستدلال. تُستدعى الدالة بالحجج التالية: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. سيتضمن `callback_kwargs` قائمة بجميع المصفوفات كما حددتها `callback_on_step_end_tensor_inputs`. | |
| callback_on_step_end_tensor_inputs (`list`، *اختياري*) : قائمة مدخلات المصفوفات (tensors) لدالة `callback_on_step_end`. سيتم تمرير المصفوفات المحددة في القائمة كحجة `callback_kwargs`. لن تتمكن من تضمين سوى المتغيرات المدرجة في خاصية `._callback_tensor_inputs` لفئة خط الأنابيب (pipeline) الخاص بك. | |
| max_sequence_length (`int`، القيمة الافتراضية `226`) : الحد الأقصى لطول التسلسل في الموجه المُرمَّز. يجب أن يكون متسقًا مع `self.transformer.config.max_text_seq_length` وإلا فقد يؤدي ذلك إلى نتائج غير جيدة. | |
| **يعيد:** [CogVideoXPipelineOutput](/docs/diffusers/main/ar/api/pipelines/cogvideox#diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput) أو `tuple` | |
| [CogVideoXPipelineOutput](/docs/diffusers/main/ar/api/pipelines/cogvideox#diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput) إذا كان `return_dict` هو True، وإلا فسيكون `tuple`. عند إرجاع tuple، يكون العنصر الأول قائمة تحتوي على الصور المولّدة. | |
| الدالة التي تُستدعى عند استدعاء خط الأنابيب للتوليد. | |
| أمثلة: | |
| ```python | |
| >>> import torch | |
| >>> from diffusers import CogVideoXFunControlPipeline, DDIMScheduler | |
| >>> from diffusers.utils import export_to_video, load_video | |
| >>> pipe = CogVideoXFunControlPipeline.from_pretrained( | |
| ... "alibaba-pai/CogVideoX-Fun-V1.1-5b-Pose", torch_dtype=torch.bfloat16 | |
| ... ) | |
| >>> pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config) | |
| >>> pipe.to("cuda") | |
| >>> control_video = load_video( | |
| ... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/hiker.mp4" | |
| ... ) | |
| >>> prompt = ( | |
| ... "An astronaut stands triumphantly at the peak of a towering mountain. Panorama of rugged peaks and " | |
| ... "valleys. Very futuristic vibe and animated aesthetic. Highlights of purple and golden colors in " | |
| ... "the scene. The sky is looks like an animated/cartoonish dream of galaxies, nebulae, stars, planets, " | |
| ... "moons, but the remainder of the scene is mostly realistic." | |
| ... ) | |
| >>> video = pipe(prompt=prompt, control_video=control_video).frames[0] | |
| >>> export_to_video(video, "output.mp4", fps=8) | |
| ``` | |
| #### encode_prompt[[diffusers.CogVideoXFunControlPipeline.encode_prompt]] | |
| ```python | |
| encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 226, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_fun_control.py#L253) | |
| **المعاملات:** | |
| prompt (`str` أو `list[str]`، *اختياري*) : النص الذي سيتم ترميزه | |
| negative_prompt (`str` أو `list[str]`، *اختياري*) : الموجه أو الموجهات التي لا ينبغي توجيه توليد الصورة بها. إذا لم يُعرَّف، يجب تمرير `negative_prompt_embeds` بدلاً من ذلك. يتم تجاهله عند عدم استخدام التوجيه (أي يتم تجاهله إذا كان `guidance_scale` أقل من `1`). | |
| do_classifier_free_guidance (`bool`، *اختياري*، الافتراضي `True`) : ما إذا كان سيتم استخدام classifier free guidance أم لا. | |
| num_videos_per_prompt (`int`، *اختياري*، القيمة الافتراضية 1) : عدد مقاطع الفيديو التي يجب توليدها لكل موجه. جهاز torch الذي سيتم وضع التضمينات الناتجة عليه | |
| prompt_embeds (`torch.Tensor`، *اختياري*) : تمثيلات نصية مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد تمثيلات النص من معامل الإدخال `prompt`. | |
| negative_prompt_embeds (`torch.Tensor`, *اختياري*) : تمثيلات نصية سالبة مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة، *مثلًا* وزن الأوامر. إذا لم تُقدَّم، فسيتم توليد negative_prompt_embeds من معامل الإدخال `negative_prompt`. | |
| device : (`torch.device`, *اختياري*): جهاز torch | |
| dtype : (`torch.dtype`, *اختياري*): torch dtype | |
| يقوم بتشفير الموجه إلى حالات مخفية لمشفّر النص. | |
| #### fuse_qkv_projections[[diffusers.CogVideoXFunControlPipeline.fuse_qkv_projections]] | |
| ```python | |
| fuse_qkv_projections() | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_fun_control.py#L473) | |
| يتيح الإسقاطات المدمجة لـ QKV. | |
| #### unfuse_qkv_projections[[diffusers.CogVideoXFunControlPipeline.unfuse_qkv_projections]] | |
| ```python | |
| unfuse_qkv_projections() | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_cogvideox_fun_control.py#L478) | |
| تعطيل دمج إسقاط QKV إذا كان مفعلاً. | |
| ## CogVideoXPipelineOutput[[diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput]] | |
| #### diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput[[diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput]] | |
| ```python | |
| diffusers.pipelines.cogvideo.pipeline_output.CogVideoXPipelineOutput(frames: Tensor) | |
| ``` | |
| [المصدر](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cogvideo/pipeline_output.py#L9) | |
| **المعاملات:** | |
| frames (`torch.Tensor` أو `np.ndarray` أو list[list[PIL.Image.Image]]) : قائمة من مخرجات الفيديو - يمكن أن تكون قائمة متداخلة بطول `batch_size,` حيث تحتوي كل قائمة فرعية على تسلسلات من صور PIL منزوعة الضوضاء بطول `num_frames.` كما يمكن أن تكون مصفوفة NumPy أو متجه Torch بشكل `(batch_size, num_frames, channels, height, width)`. | |
| فئة الإخراج لخطوط أنابيب CogVideo. | |
Xet Storage Details
- Size:
- 72.6 kB
- Xet hash:
- d92b82925e7ff419aa0b2626785b19bf914de8e767a9a44f9dfdf9b4cead3d75
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.