Buckets:

mishig's picture
|
download
raw
63.2 kB

مرخّص بموجب ترخيص Apache الإصدار 2.0 (المسمى "الترخيص")

لا يجوز لك استخدام هذا الملف إلا وفقاً لشروط الترخيص.

يمكنك الحصول على نسخة من الترخيص في

http://www.apache.org/licenses/LICENSE-2.0

ما لم يقتضِ ذلك القانون المعمول به أو ما اتُّفق عليه كتابياً، البرمجيات

تُوزَّع بموجب الرخصة على أساس "كما هي"،

بلا أي ضمانات أو شروط من أي نوع، سواء صريحة أو ضمنية.

راجع الترخيص لمعرفة اللغة المحددة التي تحكم الصلاحيات و

قيود بموجب الترخيص. -->

Helios

هيليوس: نموذج لتوليد مقاطع فيديو طويلة في الوقت الفعلي الحقيقي من جامعة بكين وByteDance وغيرهما، بقلم شينغهاي يوان، يوانيانغ يين، تسونغجيان لي، شينوي هوانغ، شياو يانغ، لي يوان.

  • نُقدّم Helios، وهو أول نموذج لتوليد الفيديو بحجم 14B يعمل بسرعة 17 إطارًا في الثانية على وحدة معالجة رسومات NVIDIA H100 واحدة، ويدعم التوليد على مقياس الدقائق مع مطابقة خط أساس قوي في الجودة. نحقق اختراقات في ثلاثة أبعاد رئيسية: (1) المتانة ضد انحراف الفيديو الطويل دون استخدام تقنيات تجريبية شائعة لمنع الانحراف مثل الإلزام الذاتي (self-forcing) أو بنوك الأخطاء أو أخذ عينات من الإطارات الرئيسية؛ (2) التوليد في الوقت الفعلي دون استخدام تقنيات تسريع قياسية مثل ذاكرة KV-cache أو الأقنعة السببية (causal masking) أو الانتباه المتناثر (sparse attention)؛ و(3) التدريب دون أطر التوازي أو تقسيم البيانات (sharding)، مما يتيح أحجام دفع (batch sizes) بمقياس انتشار الصور (image-diffusion) مع استيعاب ما يصل إلى أربعة نماذج بحجم 14B ضمن 80 جيجابايت من ذاكرة وحدة معالجة الرسومات. على وجه التحديد، Helios هو نموذج انتشار توليدي ذاتي (autoregressive diffusion model) بحجم 14B مع تمثيل موحّد للمدخلات يدعم بشكل أصلي مهام T2V وI2V وV2V. للتخفيف من الانحراف في توليد الفيديو الطويل، نحدد أنماط فشله النموذجية ونقترح استراتيجيات تدريب بسيطة وفعالة تحاكي الانحراف صراحةً أثناء التدريب، مع القضاء على الحركة التكرارية من مصدرها. من حيث الكفاءة، نضغط السياق التاريخي والضوضاء بشدة ونقلل عدد خطوات أخذ العينات، مما يؤدي إلى تكاليف حسابية مماثلة لتكاليف نماذج توليد الفيديو بحجم 1.3B أو أقل منها. علاوة على ذلك، نُقدّم تحسينات على مستوى البنية التحتية تسرّع كلًا من الاستدلال والتدريب مع تقليل استهلاك الذاكرة. تُظهر التجارب الواسعة أن Helios يتفوق باستمرار على الأساليب السابقة في كل من توليد الفيديو القصير والطويل. جميع الأكواد والنماذج متاحة في هذا الرابط.

تدعم مكتبة Diffusers نماذج Helios التالية:

  • Helios-Base: أفضل جودة، مع v-prediction وCFG القياسي وHeliosScheduler مخصص.
  • Helios-Mid: وزن متوسط، مع v-prediction وCFG-Zero* ومجدول HeliosScheduler مخصص.
  • Helios-Distilled: أفضل كفاءة، مع التنبؤ x0-prediction ومجدول HeliosDMDScheduler مخصص.

انقر على نماذج Helios في الشريط الجانبي الأيمن للحصول على مزيد من الأمثلة على توليد الفيديو.

تحسين الذاكرة وسرعة الاستدلال

يُبيّن المثال أدناه كيفية توليد فيديو من نص مُحسَّن للذاكرة أو لسرعة الاستدلال.

راجع دليل تقليل استهلاك الذاكرة لمزيد من التفاصيل حول تقنيات توفير الذاكرة المختلفة.

يتطلب نموذج Helios أدناه حوالي 6 جيجابايت من ذاكرة VRAM.

import torch
from diffusers import AutoModel, HeliosPipeline
from diffusers.hooks.group_offloading import apply_group_offloading
from diffusers.utils import export_to_video

vae = AutoModel.from_pretrained("BestWishYsh/Helios-Base", subfolder="vae", dtype=torch.float32)

# group-offloading
pipeline = HeliosPipeline.from_pretrained(
    "BestWishYsh/Helios-Base",
    vae=vae,
    dtype=torch.bfloat16
)
pipeline.enable_group_offload(
    onload_device=torch.device("cuda"),
    offload_device=torch.device("cpu"),
    offload_type="leaf_level",
    use_stream=True,
    record_stream=True,
)

prompt = """
A vibrant tropical fish swimming gracefully among colorful coral reefs in a clear, turquoise ocean. The fish has bright blue 
and yellow scales with a small, distinctive orange spot on its side, its fins moving fluidly. The coral reefs are alive with 
a variety of marine life, including small schools of colorful fish and sea turtles gliding by. The water is crystal clear, 
allowing for a view of the sandy ocean floor below. The reef itself is adorned with a mix of hard and soft corals in shades 
of red, orange, and green. The photo captures the fish from a slightly elevated angle, emphasizing its lively movements and 
the vivid colors of its surroundings. A close-up shot with dynamic movement.
"""
negative_prompt = """
Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality,
low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured,
misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards
"""

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    num_frames=99,
    num_inference_steps=50,
    guidance_scale=5.0,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_base_t2v_output.mp4", fps=24)

يكون التجميع بطيئًا في المرة الأولى، لكن الاستدعاءات اللاحقة للخط الأنابيب تكون أسرع. يمكن لخوادم الانتباه Attention Backends مثل FlashAttention وSageAttention أن تزيد السرعة بشكل كبير من خلال تحسين حساب آلية الانتباه. يقسم Context Parallelism تسلسل الإدخال عبر أجهزة متعددة لتمكين معالجة السياقات الطويلة بالتوازي، مما يقلل من ضغط الذاكرة وزمن الاستجابة. كما قد يسرّع Caching الاستدلال من خلال تخزين المخرجات الوسيطة وإعادة استخدامها.

import torch
from diffusers import AutoModel, HeliosPipeline
from diffusers.utils import export_to_video

vae = AutoModel.from_pretrained("BestWishYsh/Helios-Base", subfolder="vae", dtype=torch.float32)

pipeline = HeliosPipeline.from_pretrained(
    "BestWishYsh/Helios-Base",
    vae=vae,
    dtype=torch.bfloat16
)
pipeline.to("cuda")  # or "mps", "xpu", "cpu"

# attention backend
# pipeline.transformer.set_attention_backend("flash")
pipeline.transformer.set_attention_backend("_flash_3_hub") # For Hopper GPUs

# torch.compile
torch.backends.cudnn.benchmark = True
pipeline.text_encoder.compile(mode="max-autotune-no-cudagraphs", dynamic=False)
pipeline.vae.compile(mode="max-autotune-no-cudagraphs", dynamic=False)
pipeline.transformer.compile(mode="max-autotune-no-cudagraphs", dynamic=False)

prompt = """
A vibrant tropical fish swimming gracefully among colorful coral reefs in a clear, turquoise ocean. The fish has bright blue 
and yellow scales with a small, distinctive orange spot on its side, its fins moving fluidly. The coral reefs are alive with 
a variety of marine life, including small schools of colorful fish and sea turtles gliding by. The water is crystal clear, 
allowing for a view of the sandy ocean floor below. The reef itself is adorned with a mix of hard and soft corals in shades 
of red, orange, and green. The photo captures the fish from a slightly elevated angle, emphasizing its lively movements and 
the vivid colors of its surroundings. A close-up shot with dynamic movement.
"""
negative_prompt = """
Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality,
low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured,
misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards
"""

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    num_frames=99,
    num_inference_steps=50,
    guidance_scale=5.0,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_base_t2v_output.mp4", fps=24)

التوليد باستخدام Helios-Base

يُبيّن المثال أدناه كيفية استخدام Helios-Base لتوليد فيديو بناءً على نص أو صورة أو فيديو.

import torch
from diffusers import AutoModel, HeliosPipeline
from diffusers.utils import export_to_video, load_video, load_image

vae = AutoModel.from_pretrained("BestWishYsh/Helios-Base", subfolder="vae", dtype=torch.float32)

pipeline = HeliosPipeline.from_pretrained(
    "BestWishYsh/Helios-Base",
    vae=vae,
    dtype=torch.bfloat16
)
pipeline.to("cuda")  # or "mps", "xpu", "cpu"

negative_prompt = """
Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality,
low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured,
misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards
"""

# For Text-to-Video
prompt = """
A vibrant tropical fish swimming gracefully among colorful coral reefs in a clear, turquoise ocean. The fish has bright blue 
and yellow scales with a small, distinctive orange spot on its side, its fins moving fluidly. The coral reefs are alive with 
a variety of marine life, including small schools of colorful fish and sea turtles gliding by. The water is crystal clear, 
allowing for a view of the sandy ocean floor below. The reef itself is adorned with a mix of hard and soft corals in shades 
of red, orange, and green. The photo captures the fish from a slightly elevated angle, emphasizing its lively movements and 
the vivid colors of its surroundings. A close-up shot with dynamic movement.
"""

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    num_frames=99,
    num_inference_steps=50,
    guidance_scale=5.0,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_base_t2v_output.mp4", fps=24)

# For Image-to-Video
prompt = """
A towering emerald wave surges forward, its crest curling with raw power and energy. Sunlight glints off the translucent water, 
illuminating the intricate textures and deep green hues within the wave’s body. A thick spray erupts from the breaking crest, 
casting a misty veil that dances above the churning surface. As the perspective widens, the immense scale of the wave becomes 
apparent, revealing the restless expanse of the ocean stretching beyond. The scene captures the ocean’s untamed beauty and 
relentless force, with every droplet and ripple shimmering in the light. The dynamic motion and vivid colors evoke both awe and 
respect for nature’s might.
"""
image_path = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/helios/wave.jpg"

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    image=load_image(image_path).resize((640, 384)),
    num_frames=99,
    num_inference_steps=50,
    guidance_scale=5.0,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_base_i2v_output.mp4", fps=24)

# For Video-to-Video
prompt = """
A bright yellow Lamborghini Huracn Tecnica speeds along a curving mountain road, surrounded by lush green trees 
under a partly cloudy sky. The car's sleek design and vibrant color stand out against the natural backdrop, 
emphasizing its dynamic movement. The road curves gently, with a guardrail visible on one side, adding depth to 
the scene. The motion blur captures the sense of speed and energy, creating a thrilling and exhilarating atmosphere. 
A front-facing shot from a slightly elevated angle, highlighting the car's aggressive stance and the surrounding greenery.
"""
video_path = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/helios/car.mp4"

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    video=load_video(video_path),
    num_frames=99,
    num_inference_steps=50,
    guidance_scale=5.0,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_base_v2v_output.mp4", fps=24)

التوليد باستخدام Helios-Mid

يُبيّن المثال أدناه كيفية استخدام Helios-Mid لتوليد فيديو بناءً على نص أو صورة أو فيديو.

import torch
from diffusers import AutoModel, HeliosPyramidPipeline
from diffusers.utils import export_to_video, load_video, load_image

vae = AutoModel.from_pretrained("BestWishYsh/Helios-Mid", subfolder="vae", dtype=torch.float32)

pipeline = HeliosPyramidPipeline.from_pretrained(
    "BestWishYsh/Helios-Mid",
    vae=vae,
    dtype=torch.bfloat16
)
pipeline.to("cuda")  # or "mps", "xpu", "cpu"

negative_prompt = """
Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality,
low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured,
misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards
"""

# For Text-to-Video
prompt = """
A vibrant tropical fish swimming gracefully among colorful coral reefs in a clear, turquoise ocean. The fish has bright blue 
and yellow scales with a small, distinctive orange spot on its side, its fins moving fluidly. The coral reefs are alive with 
a variety of marine life, including small schools of colorful fish and sea turtles gliding by. The water is crystal clear, 
allowing for a view of the sandy ocean floor below. The reef itself is adorned with a mix of hard and soft corals in shades 
of red, orange, and green. The photo captures the fish from a slightly elevated angle, emphasizing its lively movements and 
the vivid colors of its surroundings. A close-up shot with dynamic movement.
"""

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    num_frames=99,
    pyramid_num_inference_steps_list=[20, 20, 20],
    guidance_scale=5.0,
    use_zero_init=True,
    zero_steps=1,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_pyramid_t2v_output.mp4", fps=24)

# For Image-to-Video
prompt = """
A towering emerald wave surges forward, its crest curling with raw power and energy. Sunlight glints off the translucent water, 
illuminating the intricate textures and deep green hues within the wave’s body. A thick spray erupts from the breaking crest, 
casting a misty veil that dances above the churning surface. As the perspective widens, the immense scale of the wave becomes 
apparent, revealing the restless expanse of the ocean stretching beyond. The scene captures the ocean’s untamed beauty and 
relentless force, with every droplet and ripple shimmering in the light. The dynamic motion and vivid colors evoke both awe and 
respect for nature’s might.
"""
image_path = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/helios/wave.jpg"

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    image=load_image(image_path).resize((640, 384)),
    num_frames=99,
    pyramid_num_inference_steps_list=[20, 20, 20],
    guidance_scale=5.0,
    use_zero_init=True,
    zero_steps=1,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_pyramid_i2v_output.mp4", fps=24)

# For Video-to-Video
prompt = """
A bright yellow Lamborghini Huracn Tecnica speeds along a curving mountain road, surrounded by lush green trees 
under a partly cloudy sky. The car's sleek design and vibrant color stand out against the natural backdrop, 
emphasizing its dynamic movement. The road curves gently, with a guardrail visible on one side, adding depth to 
the scene. The motion blur captures the sense of speed and energy, creating a thrilling and exhilarating atmosphere. 
A front-facing shot from a slightly elevated angle, highlighting the car's aggressive stance and the surrounding greenery.
"""
video_path = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/helios/car.mp4"

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    video=load_video(video_path),
    num_frames=99,
    pyramid_num_inference_steps_list=[20, 20, 20],
    guidance_scale=5.0,
    use_zero_init=True,
    zero_steps=1,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_pyramid_v2v_output.mp4", fps=24)

التوليد باستخدام Helios-Distilled

يُبيّن المثال أدناه كيفية استخدام Helios-Distilled لتوليد فيديو بناءً على نص أو صورة أو فيديو.

import torch
from diffusers import AutoModel, HeliosPyramidPipeline
from diffusers.utils import export_to_video, load_video, load_image

vae = AutoModel.from_pretrained("BestWishYsh/Helios-Distilled", subfolder="vae", dtype=torch.float32)

pipeline = HeliosPyramidPipeline.from_pretrained(
    "BestWishYsh/Helios-Distilled",
    vae=vae,
    dtype=torch.bfloat16
)
pipeline.to("cuda")  # or "mps", "xpu", "cpu"

negative_prompt = """
Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality,
low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured,
misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards
"""

# For Text-to-Video
prompt = """
A vibrant tropical fish swimming gracefully among colorful coral reefs in a clear, turquoise ocean. The fish has bright blue 
and yellow scales with a small, distinctive orange spot on its side, its fins moving fluidly. The coral reefs are alive with 
a variety of marine life, including small schools of colorful fish and sea turtles gliding by. The water is crystal clear, 
allowing for a view of the sandy ocean floor below. The reef itself is adorned with a mix of hard and soft corals in shades 
of red, orange, and green. The photo captures the fish from a slightly elevated angle, emphasizing its lively movements and 
the vivid colors of its surroundings. A close-up shot with dynamic movement.
"""

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    num_frames=240,
    pyramid_num_inference_steps_list=[2, 2, 2],
    guidance_scale=1.0,
    is_amplify_first_chunk=True,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_distilled_t2v_output.mp4", fps=24)

# For Image-to-Video
prompt = """
A towering emerald wave surges forward, its crest curling with raw power and energy. Sunlight glints off the translucent water, 
illuminating the intricate textures and deep green hues within the wave’s body. A thick spray erupts from the breaking crest, 
casting a misty veil that dances above the churning surface. As the perspective widens, the immense scale of the wave becomes 
apparent, revealing the restless expanse of the ocean stretching beyond. The scene captures the ocean’s untamed beauty and 
relentless force, with every droplet and ripple shimmering in the light. The dynamic motion and vivid colors evoke both awe and 
respect for nature’s might.
"""
image_path = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/helios/wave.jpg"

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    image=load_image(image_path).resize((640, 384)),
    num_frames=240,
    pyramid_num_inference_steps_list=[2, 2, 2],
    guidance_scale=1.0,
    is_amplify_first_chunk=True,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_distilled_i2v_output.mp4", fps=24)

# For Video-to-Video
prompt = """
A bright yellow Lamborghini Huracn Tecnica speeds along a curving mountain road, surrounded by lush green trees 
under a partly cloudy sky. The car's sleek design and vibrant color stand out against the natural backdrop, 
emphasizing its dynamic movement. The road curves gently, with a guardrail visible on one side, adding depth to 
the scene. The motion blur captures the sense of speed and energy, creating a thrilling and exhilarating atmosphere. 
A front-facing shot from a slightly elevated angle, highlighting the car's aggressive stance and the surrounding greenery.
"""
video_path = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/helios/car.mp4"

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    video=load_video(video_path),
    num_frames=240,
    pyramid_num_inference_steps_list=[2, 2, 2],
    guidance_scale=1.0,
    is_amplify_first_chunk=True,
    generator=torch.Generator("cuda").manual_seed(42),
).frames[0]
export_to_video(output, "helios_distilled_v2v_output.mp4", fps=24)

عروض النماذج من النص إلى الفيديو

فيديو مُولَّد من موجه


محارب فيكنغ يقود حافلة مدينة حديثة مليئة بالركاب. يمتلك المحارب شعرًا أشقر طويلًا مربوطًا للخلف، ولحية، وهو مزوّد بخوذة مدرّعة بالفراء ودروع. يرتدي تونيكًا وسروالًا تقليديين، لكنه يضع أيضًا حزام أمان بينما يركّز على التنقل في الشوارع المزدحمة. الداخلية للحافلة نموذجية، مع صفوف من المقاعد يشغلها ركاب متنوعون يمارسون روتينهم اليومي. اللقطات الخارجية تُظهر البيئة الحضرية النشطة، بما في ذلك المباني الشاهقة والمركبات. لقطة متوسطة تركز على المحارب خلف المقود، مع لقطات قريبة متقطعة تعكس تعبيره الحازم.


  
    
  



لقطة تصوير طبيعية بأسلوب وثائقي من شاحنة كاميرا تتحرك إلى اليسار، تلتقط سرطاناً يزحف بسرعة إلى جحره. يمتلك السرطان قشرة صلبة بلون أخضر مائل إلى البني ومخالب طويلة، ويتحرك بسرعة حاسمة عبر الأرض الرملية. جسمه مقوس قليلاً بينما يحفر في الرمل، تاركاً وراءه أثراً صغيراً. يظهر في الخلفية شاطئ ضحل متناثر عليه الصخور والقواقع البحرية، بينما تتميز الأفق بمنحنى لطيف لخط الساحل. تتميز الصورة بملمس طبيعي وواقعي، مع التأكيد على الحركة الطبيعية للسرطان وملمس الرمل. لقطة مقرّبة من زاوية مرتفعة قليلاً.


  
    
  

عروض من الصورة إلى الفيديو

فيديو مُولّد من موجه صورة



تسرع سيارة كيا الحمراء الأنيقة على طريق ريفي تحت سماء غائمة، حيث يُبرز التصميم العصري والحركة الديناميكية للسيارة ضبابية الحركة في الحقول والأشجار المحيطة الممتدة حتى الأفق. يعكس الطلاء اللامع الخارجي للسيارة السماء الملبدة بالغيوم، مما يُبرز شكلها الهوائي ومظهرها الرياضي. تحمل لوحة التسجيل الرقم "KIA 626"، وتعمل مصابيح السيارة الأمامية، مما يزيد من إحساس الحركة والطاقة. ينحني الطريق بلطف، وتُوضع السيارة قليلاً خارج المركز، مما يخلق إحساساً بزخم أمامي. يلتقط منظور أمامي جانبي ديناميكي الحضور القوي للسيارة مقابل خلفية هادئة من التلال المتدحرجة والأشجار المتناثرة.


  
    
  




تُظهر اللقطة القريبة قطاً برتقاليًا فخمًا بفراء كثيف، بعيون خضراء لافتة وشاربين أبيضين، يتأمل الكاميرا بتركيز. فراء القط ناعم ومنسّق بعناية، يجمع بين درجات البرتقالي الدافئ والكرمي. عيناه الكبيرتان المعبرتان خضراوان زاهيتان، تعكسان الفضول واليقظة. أنفه صغير وردي، وفمه مفتوح قليلاً ليكشف عن لمحة من لسانه الوردي. الخلفية ضبابية ناعمة، مما يوحي بإعداد داخلي مريح بدرجات محايدة. تتميز الصورة بعمق ميداني ضحل، حيث يتركز التركيز بوضوح على وجه القط بينما تبقى الخلفية خارج نطاق التركيز. لقطة قريبة من منظور مرتفع قليلاً.


  
    
  

عروض الفيديو التفاعلية

فيديو مُولَّد من موجه


يمكن العثور على الأمر هنا

  
    
  



يمكن العثور على الأمر هنا

  
    
  

الموارد

تعرف على المزيد حول Helios من خلال الموارد التالية.

HeliosPipeline[[diffusers.HeliosPipeline]]

diffusers.HeliosPipeline[[diffusers.HeliosPipeline]]

diffusers.HeliosPipeline(tokenizer: AutoTokenizer, text_encoder: UMT5EncoderModel, vae: AutoencoderKLWan, scheduler: HeliosScheduler, transformer: HeliosTransformer3DModel)

المصدر

المعاملات:

tokenizer (T5Tokenizer) : مُجزِّئ من T5، وتحديداً النسخة google/umt5-xxl.

text_encoder (T5EncoderModel) : T5، وتحديداً النسخة google/umt5-xxl.

transformer (HeliosTransformer3DModel) : نموذج Transformer مشروط لإزالة الضوضاء من المتغيرات الكامنة المدخلة.

scheduler (HeliosScheduler) : مُجدول يُستخدم بالاقتران مع transformer لإزالة الضوضاء من الكامنات المُرمّزة للصورة.

vae (AutoencoderKLWan) : نموذج الترميز التحويلي التبايني (VAE) لتشفير وفك تشفير مقاطع الفيديو إلى تمثيلات كامنة ومنها.

خط أنابيب لتوليد الفيديو من النص / من الصورة / من الفيديو باستخدام Helios.

يرث هذا النموذج من DiffusionPipeline. راجع توثيق الفئة الأصلية لمعرفة الطرق العامة المُنفَّذة لجميع خطوط الأنابيب (التنزيل، الحفظ، التشغيل على جهاز معين، إلخ).

call[[diffusers.HeliosPipeline.call]]

__call__(prompt: str | list[str] = None, negative_prompt: str | list[str] = None, height: int = 384, width: int = 640, num_frames: int = 132, num_inference_steps: int = 50, sigmas: list[float] = None, guidance_scale: float = 5.0, num_videos_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, output_type: str | None = 'np', 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 = 512, image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor], NoneType] = None, image_latents: typing.Optional[torch.Tensor] = None, fake_image_latents: typing.Optional[torch.Tensor] = None, add_noise_to_image_latents: bool = True, image_noise_sigma_min: float = 0.111, image_noise_sigma_max: float = 0.135, video: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor], NoneType] = None, video_latents: typing.Optional[torch.Tensor] = None, add_noise_to_video_latents: bool = True, video_noise_sigma_min: float = 0.111, video_noise_sigma_max: float = 0.135, history_sizes: list = [16, 2, 1], num_latent_frames_per_chunk: int = 9, keep_first_frame: bool = True, is_skip_first_chunk: bool = False)

المصدر

المعاملات:

prompt (str أو list[str]، اختياري) : الأمر أو الأوامر التي تُوجّه توليد الصورة. إذا لم تُعرَّف، فمرّر prompt_embeds بدلاً من ذلك.

negative_prompt (str أو list[str]، اختياري) : الموجه أو الموجهات التي يجب تجنبها أثناء توليد الصورة. إذا لم يُعرَّف، فمرّر negative_prompt_embeds بدلاً من ذلك. يتم تجاهله عند عدم استخدام التوجيه (guidance_scale < 1).

height (int، القيمة الافتراضية 384) : ارتفاع الصورة المولّدة بالبكسل.

width (int، القيمة الافتراضية 640) : عرض الصورة المولدة بالبكسل.

num_frames (int، القيمة الافتراضية 132) : عدد الإطارات في الفيديو المولّد.

num_inference_steps (int، القيمة الافتراضية 50) : عدد خطوات إزالة الضوضاء. تؤدي زيادة عدد خطوات إزالة الضوضاء عادةً إلى صورة ذات جودة أعلى على حساب بطء الاستدلال.

sigmas (list[float]، اختياري) : قيم سيجما مخصصة لاستخدامها في عملية إزالة الضوضاء. إذا لم تُعرَّف، يتم استخدام الجدول الافتراضي للمجدول.

guidance_scale (float، القيمة الافتراضية 5.0) : مقياس التوجيه كما هو مُعرَّف في Classifier-Free Diffusion Guidance. يُعرَّف guidance_scale على أنه w من المعادلة 2. في Imagen Paper. يتم تفعيل مقياس التوجيه عن طريق تعيين guidance_scale > 1. يشجع مقياس التوجيه الأعلى على توليد صور مرتبطة ارتباطًا وثيقًا بنص prompt، وعادةً على حساب انخفاض جودة الصورة.

num_videos_per_prompt (int، اختياري، القيمة الافتراضية 1) : عدد الصور التي سيتم توليدها لكل موجه.

generator (torch.Generator أو list[torch.Generator]، اختياري) : torch.Generator لجعل التوليد حتميًا.

latents (torch.Tensor، اختياري) : كامنات ضجيج مُولّدة مسبقًا، مُستخرجة من توزيع غاوسي، تُستخدم كمدخلات لتوليد الصور. يمكن استخدامها لتعديل نفس التوليد باستخدام أوامر مختلفة. إذا لم تُقدَّم، يتم توليد كامنات من خلال الاستخراج باستخدام generator العشوائي المُقدَّم.

prompt_embeds (torch.Tensor، اختياري) : تمثيلات نصية مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة (وزن الأوامر). إذا لم تُقدَّم، يتم توليد تمثيلات النص من معامل الإدخال prompt.

negative_prompt_embeds (torch.Tensor، اختياري) : تمثيلات نصية سالبة مُولّدة مسبقًا. إذا لم تُقدَّم، يتم توليدها من negative_prompt.

output_type (str، اختياري، الافتراضي "np") : صيغة الصورة المولّدة. اختر بين PIL.Image أو np.array.

return_dict (bool، اختياري، الافتراضي True) : ما إذا كان يجب إرجاع HeliosPipelineOutput بدلاً من tuple عادي.

attention_kwargs (dict، اختياري) : قاموس kwargs يُمرَّر إلى AttentionProcessor إذا تم تحديده، كما هو معرَّف تحت self.processor في diffusers.models.attention_processor.

callback_on_step_end (Callable، PipelineCallback، MultiPipelineCallbacks، اختياري) : دالة أو فئة فرعية من PipelineCallback أو MultiPipelineCallbacks تُستدعى في نهاية كل خطوة إزالة ضوضاء أثناء الاستدلال، مع الحُجج التالية: 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، القيمة الافتراضية 512) : الحد الأقصى لطول تسلسل مُشفِّر النص. إذا كان النص المطروح أطول من ذلك، فسيتم اقتطاعه. وإذا كان أقصر، فسيتم ملؤه حتى يصل إلى هذا الطول.

image (PipelineImageInput، اختياري) : صورة الإدخال المستخدمة لتكييف التحويل من صورة إلى فيديو.

image_latents (torch.Tensor، اختياري) : كامنات صورة مُرمّزة مسبقًا لاستخدامها بدلًا من image.

fake_image_latents (torch.Tensor، اختياري) : كامنات صور وهمية اختيارية تُستخدم أثناء التكييف.

add_noise_to_image_latents (bool، اختياري، القيمة الافتراضية True) : ما إذا كان يجب إضافة ضوضاء إلى كامنات الصورة قبل إزالة الضوضاء.

image_noise_sigma_min (float، اختياري، القيمة الافتراضية 0.111) : القيمة الدنيا لسيجما للضوضاء المضافة إلى كامنات الصورة.

image_noise_sigma_max (float، اختياري، القيمة الافتراضية 0.135) : القيمة القصوى لسيجما للضوضاء المضافة إلى كامنات الصورة.

video (PipelineImageInput، اختياري) : فيديو الإدخال المستخدم لتكييف الفيديو إلى فيديو.

video_latents (torch.Tensor، اختياري) : كامنات فيديو مُرمّزة مسبقًا لاستخدامها بدلًا من video.

add_noise_to_video_latents (bool، اختياري، القيمة الافتراضية True) : ما إذا كان يجب إضافة ضوضاء إلى كامنات الفيديو قبل إزالة الضوضاء.

video_noise_sigma_min (float، اختياري، القيمة الافتراضية 0.111) : القيمة الدنيا لسيجما للضوضاء المضافة إلى كامنات الفيديو.

video_noise_sigma_max (float، اختياري، القيمة الافتراضية 0.135) : القيمة القصوى لسيجما للضوضاء المضافة إلى كامنات الفيديو.

history_sizes (list، اختياري، القيمة الافتراضية [16, 2, 1]) : أحجام نوافذ التاريخ المستخدمة للتوليد المقطعي الذاتي التراجع.

num_latent_frames_per_chunk (int، اختياري، القيمة الافتراضية 9) : عدد الإطارات الكامنة المُنتَجة لكل شريحة أثناء التوليد الذاتي التتابعي.

keep_first_frame (bool، اختياري، الافتراضي True) : ما إذا كان يجب الاحتفاظ بالإطار الأول عبر المقاطع.

is_skip_first_chunk (bool، اختياري، الافتراضي False) : ما إذا كان سيتم تخطي توليد الجزء الأول.

يعيد: ~HeliosPipelineOutput أو tuple

إذا كان return_dict هو True، يُعاد HeliosPipelineOutput، وإلا يُعاد tuple حيث يكون العنصر الأول قائمة بالصور المولّدة والعنصر الثاني قائمة من قيم bool تشير إلى ما إذا كانت الصورة المولّدة المقابلة تحتوي على محتوى "غير آمن للعمل" (nsfw).

دالة الاستدعاء call لخط الأنابيب pipeline الخاص بالتوليد.

أمثلة:

>>> import torch
>>> from diffusers.utils import export_to_video
>>> from diffusers import AutoencoderKLWan, HeliosPipeline

>>> # Available models: BestWishYsh/Helios-Base, BestWishYsh/Helios-Mid, BestWishYsh/Helios-Distilled
>>> model_id = "BestWishYsh/Helios-Base"
>>> vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
>>> pipe = HeliosPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
>>> pipe.to("cuda")

>>> prompt = "A cat and a dog baking a cake together in a kitchen. The cat is carefully measuring flour, while the dog is stirring the batter with a wooden spoon. The kitchen is cozy, with sunlight streaming through the window."
>>> negative_prompt = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards"

>>> output = pipe(
...     prompt=prompt,
...     negative_prompt=negative_prompt,
...     height=384,
...     width=640,
...     num_frames=132,
...     guidance_scale=5.0,
... ).frames[0]
>>> export_to_video(output, "output.mp4", fps=24)

encode_prompt[[diffusers.HeliosPipeline.encode_prompt]]

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)

المصدر

المعاملات:

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

يقوم بتشفير الموجه إلى حالات مخفية لمشفّر النص.

HeliosPyramidPipeline[[diffusers.HeliosPyramidPipeline]]

diffusers.HeliosPyramidPipeline[[diffusers.HeliosPyramidPipeline]]

diffusers.HeliosPyramidPipeline(tokenizer: AutoTokenizer, text_encoder: UMT5EncoderModel, vae: AutoencoderKLWan, scheduler: diffusers.schedulers.scheduling_helios.HeliosScheduler | diffusers.schedulers.scheduling_helios_dmd.HeliosDMDScheduler, transformer: HeliosTransformer3DModel, is_cfg_zero_star: bool = False, is_distilled: bool = False)

المصدر

المعاملات:

tokenizer (T5Tokenizer) : مُجزِّئ من T5، وتحديداً النسخة google/umt5-xxl.

text_encoder (T5EncoderModel) : T5، وتحديداً النسخة google/umt5-xxl.

transformer (HeliosTransformer3DModel) : نموذج Transformer مشروط لإزالة الضوضاء من المتغيرات الكامنة المدخلة.

scheduler ([HeliosScheduler, HeliosDMDScheduler]) : مُجدول يُستخدم بالاقتران مع transformer لإزالة الضوضاء من كامنات الصورة المُرمّزة.

vae (AutoencoderKLWan) : نموذج الترميز التحويلي التبايني (VAE) لتشفير وفك تشفير مقاطع الفيديو إلى تمثيلات كامنة ومنها.

خط أنابيب لتوليد الفيديو من النص / من الصورة / من الفيديو باستخدام Helios.

يرث هذا النموذج من DiffusionPipeline. راجع توثيق الفئة الأصلية لمعرفة الطرق العامة المُنفَّذة لجميع خطوط الأنابيب (التنزيل، الحفظ، التشغيل على جهاز معين، إلخ).

call[[diffusers.HeliosPyramidPipeline.call]]

__call__(prompt: str | list[str] = None, negative_prompt: str | list[str] = None, height: int = 384, width: int = 640, num_frames: int = 132, sigmas: list[float] = None, guidance_scale: float = 5.0, num_videos_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, output_type: str | None = 'np', 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 = 512, image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor], NoneType] = None, image_latents: typing.Optional[torch.Tensor] = None, fake_image_latents: typing.Optional[torch.Tensor] = None, add_noise_to_image_latents: bool = True, image_noise_sigma_min: float = 0.111, image_noise_sigma_max: float = 0.135, video: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor], NoneType] = None, video_latents: typing.Optional[torch.Tensor] = None, add_noise_to_video_latents: bool = True, video_noise_sigma_min: float = 0.111, video_noise_sigma_max: float = 0.135, history_sizes: list = [16, 2, 1], num_latent_frames_per_chunk: int = 9, keep_first_frame: bool = True, is_skip_first_chunk: bool = False, pyramid_num_inference_steps_list: list = [10, 10, 10], use_zero_init: bool | None = True, zero_steps: int | None = 1, is_amplify_first_chunk: bool = False)

المصدر

المعاملات:

prompt (str أو list[str]، اختياري) : الأمر أو الأوامر التي تُوجّه توليد الصورة. إذا لم تُعرَّف، فمرّر prompt_embeds بدلاً من ذلك.

negative_prompt (str أو list[str]، اختياري) : الموجه أو الموجهات التي يجب تجنبها أثناء توليد الصورة. إذا لم يُعرَّف، فمرّر negative_prompt_embeds بدلاً من ذلك. يتم تجاهله عند عدم استخدام التوجيه (guidance_scale < 1).

height (int، القيمة الافتراضية 384) : ارتفاع الصورة المولّدة بالبكسل.

width (int، القيمة الافتراضية 640) : عرض الصورة المولدة بالبكسل.

num_frames (int، القيمة الافتراضية 132) : عدد الإطارات في الفيديو المولّد.

sigmas (list[float]، اختياري) : قيم سيجما مخصصة لاستخدامها في عملية إزالة الضوضاء. إذا لم تُعرَّف، يتم استخدام الجدول الافتراضي للمجدول.

guidance_scale (float، القيمة الافتراضية 5.0) : مقياس التوجيه كما هو مُعرَّف في Classifier-Free Diffusion Guidance. يُعرَّف guidance_scale على أنه w من المعادلة 2. في Imagen Paper. يتم تفعيل مقياس التوجيه عن طريق تعيين guidance_scale > 1. يشجع مقياس التوجيه الأعلى على توليد صور مرتبطة ارتباطًا وثيقًا بنص prompt، وعادةً على حساب انخفاض جودة الصورة.

num_videos_per_prompt (int، اختياري، القيمة الافتراضية 1) : عدد الصور التي سيتم توليدها لكل موجه.

generator (torch.Generator أو list[torch.Generator]، اختياري) : torch.Generator لجعل التوليد حتميًا.

latents (torch.Tensor، اختياري) : كامنات ضجيج مُولّدة مسبقًا، مُستخرجة من توزيع غاوسي، تُستخدم كمدخلات لتوليد الصور. يمكن استخدامها لتعديل نفس التوليد باستخدام أوامر مختلفة. إذا لم تُقدَّم، يتم توليد كامنات من خلال الاستخراج باستخدام generator العشوائي المُقدَّم.

prompt_embeds (torch.Tensor، اختياري) : تمثيلات نصية مُولّدة مسبقًا. يمكن استخدامها لتعديل مدخلات النص بسهولة (وزن الأوامر). إذا لم تُقدَّم، يتم توليد تمثيلات النص من معامل الإدخال prompt.

negative_prompt_embeds (torch.Tensor، اختياري) : تمثيلات نصية سالبة مُولّدة مسبقًا. إذا لم تُقدَّم، يتم توليدها من negative_prompt.

output_type (str، اختياري، الافتراضي "np") : صيغة الصورة المولّدة. اختر بين PIL.Image أو np.array.

return_dict (bool، اختياري، الافتراضي True) : ما إذا كان يجب إرجاع HeliosPipelineOutput بدلاً من tuple عادي.

attention_kwargs (dict، اختياري) : قاموس kwargs يُمرَّر إلى AttentionProcessor إذا تم تحديده، كما هو معرَّف تحت self.processor في diffusers.models.attention_processor.

callback_on_step_end (Callable، PipelineCallback، MultiPipelineCallbacks، اختياري) : دالة أو فئة فرعية من PipelineCallback أو MultiPipelineCallbacks تُستدعى في نهاية كل خطوة إزالة ضوضاء أثناء الاستدلال، مع الحُجج التالية: 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، القيمة الافتراضية 512) : الحد الأقصى لطول تسلسل مُشفِّر النص. إذا كان النص المطروح أطول من ذلك، فسيتم اقتطاعه. وإذا كان أقصر، فسيتم ملؤه حتى يصل إلى هذا الطول.

image (PipelineImageInput، اختياري) : صورة الإدخال المستخدمة لتكييف التحويل من صورة إلى فيديو.

image_latents (torch.Tensor، اختياري) : كامنات صورة مُرمّزة مسبقًا لاستخدامها بدلًا من image.

fake_image_latents (torch.Tensor، اختياري) : كامنات صور وهمية اختيارية تُستخدم أثناء التكييف.

add_noise_to_image_latents (bool، اختياري، القيمة الافتراضية True) : ما إذا كان يجب إضافة ضوضاء إلى كامنات الصورة قبل إزالة الضوضاء.

image_noise_sigma_min (float، اختياري، القيمة الافتراضية 0.111) : القيمة الدنيا لسيجما للضوضاء المضافة إلى كامنات الصورة.

image_noise_sigma_max (float، اختياري، القيمة الافتراضية 0.135) : القيمة القصوى لسيجما للضوضاء المضافة إلى كامنات الصورة.

video (PipelineImageInput، اختياري) : فيديو الإدخال المستخدم لتكييف الفيديو إلى فيديو.

video_latents (torch.Tensor، اختياري) : كامنات فيديو مُرمّزة مسبقًا لاستخدامها بدلًا من video.

add_noise_to_video_latents (bool، اختياري، القيمة الافتراضية True) : ما إذا كان يجب إضافة ضوضاء إلى كامنات الفيديو قبل إزالة الضوضاء.

video_noise_sigma_min (float، اختياري، القيمة الافتراضية 0.111) : القيمة الدنيا لسيجما للضوضاء المضافة إلى كامنات الفيديو.

video_noise_sigma_max (float، اختياري، القيمة الافتراضية 0.135) : القيمة القصوى لسيجما للضوضاء المضافة إلى كامنات الفيديو.

history_sizes (list، اختياري، القيمة الافتراضية [16, 2, 1]) : أحجام نوافذ التاريخ المستخدمة للتوليد المقطعي الذاتي التراجع.

num_latent_frames_per_chunk (int، اختياري، القيمة الافتراضية 9) : عدد الإطارات الكامنة المُنتَجة لكل شريحة أثناء التوليد الذاتي التتابعي.

keep_first_frame (bool، اختياري، الافتراضي True) : ما إذا كان يجب الاحتفاظ بالإطار الأول عبر المقاطع.

is_skip_first_chunk (bool، اختياري، الافتراضي False) : ما إذا كان سيتم تخطي توليد الجزء الأول.

pyramid_num_inference_steps_list (list، اختياري، القيمة الافتراضية [10, 10, 10]) : عدد خطوات الاستدلال لكل مرحلة من مراحل الهرم أثناء توليد المرحلة 2.

use_zero_init (bool، اختياري، الافتراضي True) : ما إذا كان سيتم تطبيق CFG zero-init في بداية إزالة الضوضاء.

zero_steps (int، اختياري، القيمة الافتراضية 1) : عدد الخطوات الأولية التي تستخدم CFG zero-init.

is_amplify_first_chunk (bool، اختياري، الافتراضي False) : ما إذا كان سيتم تضخيم التوجيه على الجزء الأول (متعلق بـ DMD).

يعيد: ~HeliosPipelineOutput أو tuple

إذا كان return_dict هو True، يُعاد HeliosPipelineOutput، وإلا يُعاد tuple حيث يكون العنصر الأول قائمة بالصور المولّدة والعنصر الثاني قائمة من قيم bool تشير إلى ما إذا كانت الصورة المولّدة المقابلة تحتوي على محتوى "غير آمن للعمل" (nsfw).

دالة الاستدعاء call لخط الأنابيب pipeline الخاص بالتوليد.

أمثلة:

>>> import torch
>>> from diffusers.utils import export_to_video
>>> from diffusers import AutoencoderKLWan, HeliosPyramidPipeline

>>> # Available models: BestWishYsh/Helios-Base, BestWishYsh/Helios-Mid, BestWishYsh/Helios-Distilled
>>> model_id = "BestWishYsh/Helios-Base"
>>> vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
>>> pipe = HeliosPyramidPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
>>> pipe.to("cuda")

>>> prompt = "A cat and a dog baking a cake together in a kitchen. The cat is carefully measuring flour, while the dog is stirring the batter with a wooden spoon. The kitchen is cozy, with sunlight streaming through the window."
>>> negative_prompt = "Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards"

>>> output = pipe(
...     prompt=prompt,
...     negative_prompt=negative_prompt,
...     height=384,
...     width=640,
...     num_frames=132,
...     guidance_scale=5.0,
... ).frames[0]
>>> export_to_video(output, "output.mp4", fps=24)

encode_prompt[[diffusers.HeliosPyramidPipeline.encode_prompt]]

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)

المصدر

المعاملات:

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

يقوم بتشفير الموجه إلى حالات مخفية لمشفّر النص.

HeliosPipelineOutput[[diffusers.pipelines.helios.pipeline_output.HeliosPipelineOutput]]

diffusers.pipelines.helios.pipeline_output.HeliosPipelineOutput[[diffusers.pipelines.helios.pipeline_output.HeliosPipelineOutput]]

diffusers.pipelines.helios.pipeline_output.HeliosPipelineOutput(frames: Tensor)

المصدر

المعاملات:

frames (torch.Tensor، np.ndarray، أو List[List[PIL.Image.Image]]) : قائمة من مخرجات الفيديو - يمكن أن تكون قائمة متداخلة بطول batch_size, حيث تحتوي كل قائمة فرعية على تسلسلات صور PIL منزوعة الضوضاء بطول num_frames. كما يمكن أن تكون مصفوفة NumPy أو متجه Torch بأبعاد (batch_size, num_frames, channels, height, width).

فئة الإخراج لخطوط أنابيب Helios.

Xet Storage Details

Size:
63.2 kB
·
Xet hash:
ffd2671a224029d680dc310bf821f9cec5e0e803e5dbc8df327716b397dc12d4

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.