Buckets:
| # | |
| # Licenciado sob a Apache License, Versão 2.0 (a "Licença"); | |
| # você não pode usar este arquivo, exceto em conformidade com a Licença. | |
| # Você pode obter uma cópia da Licença em | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # A menos que exigido pela lei aplicável ou acordado por escrito, o software | |
| # distribuído sob a Licença é distribuído em uma base "COMO ESTÁ", | |
| # SEM GARANTIAS OU CONDIÇÕES DE QUALQUER TIPO, expressas ou implícitas. | |
| # Consulte a Licença para o idioma específico que rege as permissões e | |
| # limitações sob a Licença. --> | |
| # Helios | |
| [Helios: Real Real-Time Long Video Generation Model](https://huggingface.co/papers/2603.04379) da Universidade de Pequim & ByteDance & etc, por Shenghai Yuan, Yuanyang Yin, Zongjian Li, Xinwei Huang, Xiao Yang, Li Yuan. | |
| * Apresentamos o Helios, o primeiro modelo de geração de vídeo de 14B que roda a 17 FPS em uma única GPU NVIDIA H100 e suporta geração em escala de minutos, mantendo a qualidade de uma forte linha de base. Alcançamos avanços em três dimensões-chave: (1) robustez à deriva em vídeos longos, sem o uso de heurísticas comuns de anti-deriva, como self-forcing, error banks ou amostragem de keyframes; (2) geração em tempo real, sem técnicas padrão de aceleração, como KV-cache, causal masking ou atenção esparsa; e (3) treinamento sem frameworks de paralelismo ou sharding, permitindo tamanhos de lote na escala de difusão de imagem, enquanto acomoda até quatro modelos de 14B em 80 GB de memória de GPU. Especificamente, o Helios é um modelo de difusão autoregressivo de 14B com uma representação de entrada unificada que suporta nativamente as tarefas T2V, I2V e V2V. Para mitigar a deriva na geração de vídeos longos, caracterizamos seus modos de falha típicos e propomos estratégias de treinamento simples, porém eficazes, que simulam explicitamente a deriva durante o treinamento, eliminando o movimento repetitivo na sua origem. Para eficiência, comprimimos fortemente o contexto histórico e ruidoso e reduzimos o número de etapas de amostragem, resultando em custos computacionais comparáveis — ou inferiores — aos de modelos generativos de vídeo de 1.3B. Além disso, introduzimos otimizações em nível de infraestrutura que aceleram tanto a inferência quanto o treinamento, reduzindo o consumo de memória. Experimentos extensos demonstram que o Helios supera consistentemente métodos anteriores tanto na geração de vídeos curtos quanto longos. Todo o código e os modelos estão disponíveis em [este URL](https://pku-yuangroup.github.io/Helios-Page). | |
| Os seguintes modelos Helios são suportados no Diffusers: | |
| - [Helios-Base](https://huggingface.co/BestWishYsh/Helios-Base): Melhor qualidade, com v-prediction, CFG padrão e HeliosScheduler personalizado. | |
| - [Helios-Mid](https://huggingface.co/BestWishYsh/Helios-Mid): Peso intermediário, com v-prediction, CFG-Zero* e HeliosScheduler personalizado. | |
| - [Helios-Distilled](https://huggingface.co/BestWishYsh/Helios-Distilled): Melhor eficiência, com x0-prediction e HeliosDMDScheduler personalizado. | |
| > [!TIP] | |
| > Clique nos modelos Helios na barra lateral à direita para mais exemplos de geração de vídeo. | |
| ### Otimizando memória e velocidade de inferência | |
| O exemplo abaixo demonstra como gerar um vídeo a partir de texto otimizado para memória ou velocidade de inferência. | |
| Consulte o guia [Reduzir o uso de memória](../../optimization/memory) para mais detalhes sobre as diversas técnicas de economia de memória. | |
| O modelo Helios abaixo requer ~6GB de VRAM. | |
| ```py | |
| 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) | |
| ``` | |
| [Compilation](../../optimization/fp16#torchcompile) é lento na primeira vez, mas as chamadas subsequentes ao pipeline são mais rápidas. [Attention Backends](../../optimization/attention_backends) como FlashAttention e SageAttention podem aumentar significativamente a velocidade ao otimizar o cálculo do mecanismo de atenção. [Context Parallelism](../../optimization/context_parallelism) divide a sequência de entrada entre vários dispositivos para permitir o processamento de contextos longos em paralelo, reduzindo a pressão de memória e a latência. [Caching](../../optimization/cache) também pode acelerar a inferência ao armazenar e reutilizar saídas intermediárias. | |
| ```py | |
| 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) | |
| ``` | |
| ### Geração com Helios-Base | |
| O exemplo abaixo demonstra como usar o Helios-Base para gerar vídeo com base em texto, imagem ou vídeo. | |
| ```python | |
| 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) | |
| ``` | |
| ### Geração com Helios-Mid | |
| O exemplo abaixo demonstra como usar o Helios-Mid para gerar vídeo com base em texto, imagem ou vídeo. | |
| ```python | |
| 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) | |
| ``` | |
| ### Geração com Helios-Distilled | |
| O exemplo abaixo demonstra como usar o Helios-Distilled para gerar vídeo com base em texto, imagem ou vídeo. | |
| ```python | |
| 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) | |
| ``` | |
| ## Exibições de Texto para Vídeo | |
| Vídeo Gerado por Prompt | |
| Um guerreiro viking dirigindo um ônibus urbano moderno cheio de passageiros. O viking tem cabelos loiros longos presos para trás, barba e usa um capacete forrado de pele e armadura. Ele veste uma túnica e calças tradicionais, mas também usa cinto de segurança enquanto se concentra em navegar pelas ruas movimentadas. O interior do ônibus é típico, com fileiras de assentos ocupados por passageiros diversos seguindo suas rotinas diárias. As imagens externas mostram o ambiente urbano agitado, incluindo prédios altos e trânsito. Plano médio focando no viking ao volante, com close-ups ocasionais de sua expressão determinada. | |
| Uma fotografia de natureza em estilo documental, filmada de um caminhão de câmera em movimento para a esquerda, capturando um caranguejo correndo rapidamente para sua toca. O caranguejo tem uma concha dura, de cor verde-marron, e garras longas, movendo-se com velocidade determinada pelo chão arenoso. Seu corpo está levemente arqueado enquanto se enterra na areia, deixando um pequeno rastro atrás. O fundo mostra uma praia rasa com pedras e conchas espalhadas, e o horizonte apresenta uma curva suave da linha costeira. A foto tem uma textura natural e realista, enfatizando o movimento natural do caranguejo e a textura da areia. Um close-up de um ângulo levemente elevado. | |
| ## Exemplos de Imagem para Vídeo | |
| Prompt de Imagem Vídeo Gerado | |
| Um elegante carro vermelho da Kia percorre em alta velocidade uma estrada rural sob um céu nublado, com seu design moderno e movimento dinâmico destacados pelo desfoque de movimento dos campos e árvores ao redor que se estendem até o horizonte. A carroceria brilhante do carro reflete o céu encoberto, realçando sua forma aerodinâmica e postura esportiva. A placa de licença exibe "KIA 626" e os faróis do veículo estão acesos, aumentando a sensação de movimento e energia. A estrada faz uma curva suave, com o carro posicionado ligeiramente fora do centro, criando uma sensação de impulso para frente. Uma vista frontal dinâmica em três quartos captura a presença poderosa do carro contra o cenário sereno de colinas ondulantes e árvores espalhadas. | |
| Um close-up captura um gato laranja fofo, com olhos verdes marcantes e bigodes brancos, olhando fixamente para a câmera. O pelo do gato é macio e bem cuidado, com uma mistura de tons quentes de laranja e creme. Seus grandes olhos expressivos são de um verde vívido, refletindo curiosidade e alerta. O nariz do gato é pequeno e rosa, e sua boca está levemente aberta, revelando um vislumbre de sua língua rosa. O fundo está suavemente desfocado, sugerindo um ambiente interno aconchegante com tons neutros. A foto tem uma profundidade de campo rasa, focando nitidamente no rosto do gato, enquanto o fundo permanece fora de foco. Um close-up tirado de uma perspectiva levemente elevada. | |
| ## Vitrine de Vídeos Interativos | |
| Vídeo Gerado por Prompt | |
| O prompt pode ser encontrado aqui | |
| O prompt pode ser encontrado aqui | |
| ## Recursos | |
| Saiba mais sobre o Helios com os seguintes recursos. | |
| - Assista a [video1](https://www.youtube.com/watch?v=vd_AgHtOUFQ) e [video2](https://www.youtube.com/watch?v=1GeIU2Dn7UY) para uma demonstração dos principais recursos do Helios. | |
| - O artigo de pesquisa, [Helios: Real Real-Time Long Video Generation Model](https://huggingface.co/papers/2603.04379), para mais detalhes. | |
| ## HeliosPipeline[[diffusers.HeliosPipeline]] | |
| #### diffusers.HeliosPipeline[[diffusers.HeliosPipeline]] | |
| ```python | |
| diffusers.HeliosPipeline(tokenizer: AutoTokenizer, text_encoder: UMT5EncoderModel, vae: AutoencoderKLWan, scheduler: HeliosScheduler, transformer: HeliosTransformer3DModel) | |
| ``` | |
| [Fonte](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/helios/pipeline_helios.py#L108) | |
| **Parâmetros:** | |
| tokenizer (`T5Tokenizer`) : Tokenizer do [T5](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5Tokenizer), especificamente a variante [google/umt5-xxl](https://huggingface.co/google/umt5-xxl). | |
| text_encoder (`T5EncoderModel`) : [T5](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel), especificamente a variante [google/umt5-xxl](https://huggingface.co/google/umt5-xxl). | |
| transformer ([HeliosTransformer3DModel](/docs/diffusers/main/pt/api/models/helios_transformer3d#diffusers.HeliosTransformer3DModel)) : Transformer condicional para desruidar os latentes de entrada. | |
| scheduler ([HeliosScheduler](/docs/diffusers/main/pt/api/schedulers/helios#diffusers.HeliosScheduler)) : Um agendador a ser usado em combinação com `transformer` para desruidar os latentes da imagem codificada. | |
| vae ([AutoencoderKLWan](/docs/diffusers/main/pt/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan)) : Modelo de Variational Auto-Encoder (VAE) para codificar e decodificar vídeos para e a partir de representações latentes. | |
| Pipeline para geração de texto-para-vídeo / imagem-para-vídeo / vídeo-para-vídeo usando Helios. | |
| Este modelo herda de [DiffusionPipeline](/docs/diffusers/main/pt/api/pipelines/overview#diffusers.DiffusionPipeline). Consulte a documentação da superclasse para os métodos genéricos implementados para todos os pipelines (download, salvamento, execução em um dispositivo específico, etc.). | |
| #### __call__[[diffusers.HeliosPipeline.__call__]] | |
| ```python | |
| __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) | |
| ``` | |
| [Fonte](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/helios/pipeline_helios.py#L445) | |
| **Parâmetros:** | |
| prompt (`str` ou `list[str]`, *opcional*) : O prompt ou os prompts para orientar a geração da imagem. Se não definido, passe `prompt_embeds` em vez disso. | |
| negative_prompt (`str` ou `list[str]`, *opcional*) : O prompt ou os prompts a evitar durante a geração de imagem. Se não definido, passe `negative_prompt_embeds` em vez disso. Ignorado quando não está usando orientação (`guidance_scale` < `1`). | |
| height (`int`, padrão `384`) : A altura em pixels da imagem gerada. | |
| width (`int`, padrão `640`) : A largura em pixels da imagem gerada. | |
| num_frames (`int`, padrão `132`) : O número de quadros no vídeo gerado. | |
| num_inference_steps (`int`, padrão `50`) : O número de etapas de remoção de ruído. Mais etapas de remoção de ruído geralmente resultam em uma imagem de maior qualidade, em detrimento de uma inferência mais lenta. | |
| sigmas (`list[float]`, *opcional*) : Sigmas personalizados para usar no processo de desruidamento. Se não definidos, o agendamento padrão do agendador é utilizado. | |
| guidance_scale (`float`, padrão `5.0`) : Escala de orientação definida em [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598). `guidance_scale` é definido como `w` da equação 2. do [Imagen Paper](https://huggingface.co/papers/2205.11487). A escala de orientação é ativada ao definir `guidance_scale > 1`. Uma escala de orientação maior incentiva a geração de imagens que estão intimamente ligadas ao `prompt` de texto, geralmente em detrimento de uma menor qualidade de imagem. | |
| num_videos_per_prompt (`int`, *opcional*, padrão 1) : O número de imagens a serem geradas por prompt. | |
| generator (`torch.Generator` ou `list[torch.Generator]`, *opcional*) : Um [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) para tornar a geração determinística. | |
| latents (`torch.Tensor`, *opcional*) : Latentes ruidosos pré-gerados, amostrados de uma distribuição gaussiana, a serem usados como entradas para a geração de imagens. Pode ser usado para ajustar a mesma geração com diferentes prompts. Se não for fornecido, um tensor de latentes é gerado por amostragem usando o `generator` aleatório fornecido. | |
| prompt_embeds (`torch.Tensor`, *opcional*) : Incorporações de texto pré-geradas. Podem ser usadas para ajustar facilmente as entradas de texto (ponderação do prompt). Se não forem fornecidas, as incorporações de texto são geradas a partir do argumento de entrada `prompt`. | |
| negative_prompt_embeds (`torch.Tensor`, *opcional*) : Embeddings de texto negativos pré-gerados. Se não fornecidos, são gerados a partir de `negative_prompt`. | |
| output_type (`str`, *opcional*, padrão `"np"`) : O formato de saída da imagem gerada. Escolha entre `PIL.Image` ou `np.array`. | |
| return_dict (`bool`, *opcional*, padrão `True`) : Se deve ou não retornar um `HeliosPipelineOutput` em vez de uma tupla simples. | |
| attention_kwargs (`dict`, *opcional*) : Um dicionário de kwargs que, se especificado, é passado para o `AttentionProcessor` conforme definido em `self.processor` em [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py). | |
| callback_on_step_end (`Callable`, `PipelineCallback`, `MultiPipelineCallbacks`, *opcional*) : Uma função ou uma subclasse de `PipelineCallback` ou `MultiPipelineCallbacks` que é chamada no final de cada etapa de remoção de ruído durante a inferência, com os seguintes argumentos: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs` incluirá uma lista de todos os tensores, conforme especificado por `callback_on_step_end_tensor_inputs`. | |
| callback_on_step_end_tensor_inputs (`list`, *opcional*) : A lista de entradas de tensor para a função `callback_on_step_end`. Os tensores especificados na lista serão passados como argumento `callback_kwargs`. Você só poderá incluir variáveis listadas no atributo `._callback_tensor_inputs` da sua classe de pipeline. | |
| max_sequence_length (`int`, padrão `512`) : O comprimento máximo da sequência do codificador de texto. Se o prompt for mais longo que isso, ele será truncado. Se o prompt for mais curto, ele será preenchido até esse comprimento. | |
| image (`PipelineImageInput`, *opcional*) : Imagem de entrada usada para a condicionamento de imagem para vídeo. | |
| image_latents (`torch.Tensor`, *opcional*) : Latentes de imagem pré-codificados para usar no lugar de `image`. | |
| fake_image_latents (`torch.Tensor`, *opcional*) : Latentes de imagem falsos opcionais usados durante o condicionamento. | |
| add_noise_to_image_latents (`bool`, *opcional*, padrão `True`) : Se deve adicionar ruído aos latentes da imagem antes do desruidamento. | |
| image_noise_sigma_min (`float`, *opcional*, padrão `0.111`) : Valor mínimo de sigma para o ruído adicionado aos latentes da imagem. | |
| image_noise_sigma_max (`float`, *opcional*, padrão `0.135`) : Valor máximo de sigma para o ruído adicionado aos latentes da imagem. | |
| video (`PipelineImageInput`, *opcional*) : Vídeo de entrada usado para condicionamento de vídeo para vídeo. | |
| video_latents (`torch.Tensor`, *opcional*) : Latentes de vídeo pré-codificados para usar no lugar de `video`. | |
| add_noise_to_video_latents (`bool`, *opcional*, padrão `True`) : Se deve adicionar ruído aos latentes do vídeo antes do desruidamento. | |
| video_noise_sigma_min (`float`, *opcional*, padrão `0.111`) : Valor mínimo de sigma para o ruído adicionado aos latentes de vídeo. | |
| video_noise_sigma_max (`float`, *opcional*, padrão `0.135`) : Valor máximo de sigma para o ruído adicionado aos latentes de vídeo. | |
| history_sizes (`list`, *opcional*, padrão `[16, 2, 1]`) : Tamanhos das janelas de histórico usados para geração autoregressiva em blocos. | |
| num_latent_frames_per_chunk (`int`, *opcional*, padrão `9`) : Número de quadros latentes produzidos por bloco durante a geração autoregressiva. | |
| keep_first_frame (`bool`, *opcional*, padrão `True`) : Se deve reter o primeiro quadro entre os blocos. | |
| is_skip_first_chunk (`bool`, *opcional*, padrão `False`) : Se deve pular a geração do primeiro bloco. | |
| **Retorna:** `~HeliosPipelineOutput` ou `tuple` | |
| Se `return_dict` for `True`, `HeliosPipelineOutput` é retornado; caso contrário, uma `tuple` é retornada, em que o primeiro elemento é uma lista com as imagens geradas e o segundo elemento é uma lista de `bool`s indicando se a imagem gerada correspondente contém conteúdo "not-safe-for-work" (nsfw). | |
| A função de chamada do pipeline para geração. | |
| Exemplos: | |
| ```python | |
| >>> 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]] | |
| ```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) | |
| ``` | |
| [Fonte](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/helios/pipeline_helios.py#L196) | |
| **Parâmetros:** | |
| prompt (`str` ou `list[str]`, *opcional*) : prompt a ser codificado | |
| negative_prompt (`str` ou `list[str]`, *opcional*) : O prompt ou os prompts que não devem orientar a geração da imagem. Se não definido, é necessário passar `negative_prompt_embeds` em vez disso. Ignorado quando não se usa orientação (ou seja, ignorado se `guidance_scale` for menor que `1`). | |
| do_classifier_free_guidance (`bool`, *opcional*, padrão `True`) : Se deve ou não usar classifier free guidance. | |
| num_videos_per_prompt (`int`, *opcional*, padrão 1) : Número de vídeos que devem ser gerados por prompt. Dispositivo torch para colocar os embeddings resultantes | |
| prompt_embeds (`torch.Tensor`, *opcional*) : Embeddings de texto pré-gerados. Podem ser usados para ajustar facilmente as entradas de texto, *por exemplo*, ponderação de prompts. Se não forem fornecidos, os embeddings de texto serão gerados a partir do argumento de entrada `prompt`. | |
| negative_prompt_embeds (`torch.Tensor`, *opcional*) : Embeddings de texto negativos pré-gerados. Podem ser usados para ajustar facilmente as entradas de texto, *por exemplo*, ponderação de prompts. Se não forem fornecidos, negative_prompt_embeds será gerado a partir do argumento de entrada `negative_prompt`. | |
| device : (`torch.device`, *opcional*): dispositivo torch | |
| dtype : (`torch.dtype`, *opcional*): dtype do torch | |
| Codifica o prompt em estados ocultos do codificador de texto. | |
| ## HeliosPyramidPipeline[[diffusers.HeliosPyramidPipeline]] | |
| #### diffusers.HeliosPyramidPipeline[[diffusers.HeliosPyramidPipeline]] | |
| ```python | |
| 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) | |
| ``` | |
| [Fonte](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/helios/pipeline_helios_pyramid.py#L121) | |
| **Parâmetros:** | |
| tokenizer (`T5Tokenizer`) : Tokenizer do [T5](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5Tokenizer), especificamente a variante [google/umt5-xxl](https://huggingface.co/google/umt5-xxl). | |
| text_encoder (`T5EncoderModel`) : [T5](https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel), especificamente a variante [google/umt5-xxl](https://huggingface.co/google/umt5-xxl). | |
| transformer ([HeliosTransformer3DModel](/docs/diffusers/main/pt/api/models/helios_transformer3d#diffusers.HeliosTransformer3DModel)) : Transformer condicional para desruidar os latentes de entrada. | |
| scheduler ([`HeliosScheduler`, `HeliosDMDScheduler`]) : Um scheduler a ser usado em combinação com `transformer` para desruidar os latentes da imagem codificada. | |
| vae ([AutoencoderKLWan](/docs/diffusers/main/pt/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan)) : Modelo de Variational Auto-Encoder (VAE) para codificar e decodificar vídeos para e a partir de representações latentes. | |
| Pipeline para geração de texto-para-vídeo / imagem-para-vídeo / vídeo-para-vídeo usando Helios. | |
| Este modelo herda de [DiffusionPipeline](/docs/diffusers/main/pt/api/pipelines/overview#diffusers.DiffusionPipeline). Consulte a documentação da superclasse para os métodos genéricos implementados para todos os pipelines (download, salvamento, execução em um dispositivo específico, etc.). | |
| #### __call__[[diffusers.HeliosPyramidPipeline.__call__]] | |
| ```python | |
| __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) | |
| ``` | |
| [Fonte](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/helios/pipeline_helios_pyramid.py#L508) | |
| **Parâmetros:** | |
| prompt (`str` ou `list[str]`, *opcional*) : O prompt ou os prompts para orientar a geração da imagem. Se não definido, passe `prompt_embeds` em vez disso. | |
| negative_prompt (`str` ou `list[str]`, *opcional*) : O prompt ou os prompts a evitar durante a geração de imagem. Se não definido, passe `negative_prompt_embeds` em vez disso. Ignorado quando não está usando orientação (`guidance_scale` < `1`). | |
| height (`int`, padrão `384`) : A altura em pixels da imagem gerada. | |
| width (`int`, padrão `640`) : A largura em pixels da imagem gerada. | |
| num_frames (`int`, padrão `132`) : O número de quadros no vídeo gerado. | |
| sigmas (`list[float]`, *opcional*) : Sigmas personalizados para usar no processo de desruidamento. Se não definidos, o agendamento padrão do agendador é utilizado. | |
| guidance_scale (`float`, padrão `5.0`) : Escala de orientação definida em [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598). `guidance_scale` é definido como `w` da equação 2. do [Imagen Paper](https://huggingface.co/papers/2205.11487). A escala de orientação é ativada ao definir `guidance_scale > 1`. Uma escala de orientação maior incentiva a geração de imagens que estão intimamente ligadas ao `prompt` de texto, geralmente em detrimento de uma menor qualidade de imagem. | |
| num_videos_per_prompt (`int`, *opcional*, padrão 1) : O número de imagens a serem geradas por prompt. | |
| generator (`torch.Generator` ou `list[torch.Generator]`, *opcional*) : Um [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) para tornar a geração determinística. | |
| latents (`torch.Tensor`, *opcional*) : Latentes ruidosos pré-gerados, amostrados de uma distribuição gaussiana, a serem usados como entradas para a geração de imagens. Pode ser usado para ajustar a mesma geração com diferentes prompts. Se não for fornecido, um tensor de latentes é gerado por amostragem usando o `generator` aleatório fornecido. | |
| prompt_embeds (`torch.Tensor`, *opcional*) : Incorporações de texto pré-geradas. Podem ser usadas para ajustar facilmente as entradas de texto (ponderação do prompt). Se não forem fornecidas, as incorporações de texto são geradas a partir do argumento de entrada `prompt`. | |
| negative_prompt_embeds (`torch.Tensor`, *opcional*) : Embeddings de texto negativos pré-gerados. Se não fornecidos, são gerados a partir de `negative_prompt`. | |
| output_type (`str`, *opcional*, padrão `"np"`) : O formato de saída da imagem gerada. Escolha entre `PIL.Image` ou `np.array`. | |
| return_dict (`bool`, *opcional*, padrão `True`) : Se deve ou não retornar um `HeliosPipelineOutput` em vez de uma tupla simples. | |
| attention_kwargs (`dict`, *opcional*) : Um dicionário de kwargs que, se especificado, é passado para o `AttentionProcessor` conforme definido em `self.processor` em [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py). | |
| callback_on_step_end (`Callable`, `PipelineCallback`, `MultiPipelineCallbacks`, *opcional*) : Uma função ou uma subclasse de `PipelineCallback` ou `MultiPipelineCallbacks` que é chamada no final de cada etapa de remoção de ruído durante a inferência, com os seguintes argumentos: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs` incluirá uma lista de todos os tensores, conforme especificado por `callback_on_step_end_tensor_inputs`. | |
| callback_on_step_end_tensor_inputs (`list`, *opcional*) : A lista de entradas de tensor para a função `callback_on_step_end`. Os tensores especificados na lista serão passados como argumento `callback_kwargs`. Você só poderá incluir variáveis listadas no atributo `._callback_tensor_inputs` da sua classe de pipeline. | |
| max_sequence_length (`int`, padrão `512`) : O comprimento máximo da sequência do codificador de texto. Se o prompt for mais longo que isso, ele será truncado. Se o prompt for mais curto, ele será preenchido até esse comprimento. | |
| image (`PipelineImageInput`, *opcional*) : Imagem de entrada usada para a condicionamento de imagem para vídeo. | |
| image_latents (`torch.Tensor`, *opcional*) : Latentes de imagem pré-codificados para usar no lugar de `image`. | |
| fake_image_latents (`torch.Tensor`, *opcional*) : Latentes de imagem falsos opcionais usados durante o condicionamento. | |
| add_noise_to_image_latents (`bool`, *opcional*, padrão `True`) : Se deve adicionar ruído aos latentes da imagem antes do desruidamento. | |
| image_noise_sigma_min (`float`, *opcional*, padrão `0.111`) : Valor mínimo de sigma para o ruído adicionado aos latentes da imagem. | |
| image_noise_sigma_max (`float`, *opcional*, padrão `0.135`) : Valor máximo de sigma para o ruído adicionado aos latentes da imagem. | |
| video (`PipelineImageInput`, *opcional*) : Vídeo de entrada usado para condicionamento de vídeo para vídeo. | |
| video_latents (`torch.Tensor`, *opcional*) : Latentes de vídeo pré-codificados para usar no lugar de `video`. | |
| add_noise_to_video_latents (`bool`, *opcional*, padrão `True`) : Se deve adicionar ruído aos latentes do vídeo antes do desruidamento. | |
| video_noise_sigma_min (`float`, *opcional*, padrão `0.111`) : Valor mínimo de sigma para o ruído adicionado aos latentes de vídeo. | |
| video_noise_sigma_max (`float`, *opcional*, padrão `0.135`) : Valor máximo de sigma para o ruído adicionado aos latentes de vídeo. | |
| history_sizes (`list`, *opcional*, padrão `[16, 2, 1]`) : Tamanhos das janelas de histórico usados para geração autoregressiva em blocos. | |
| num_latent_frames_per_chunk (`int`, *opcional*, padrão `9`) : Número de quadros latentes produzidos por bloco durante a geração autoregressiva. | |
| keep_first_frame (`bool`, *opcional*, padrão `True`) : Se deve reter o primeiro quadro entre os blocos. | |
| is_skip_first_chunk (`bool`, *opcional*, padrão `False`) : Se deve pular a geração do primeiro bloco. | |
| pyramid_num_inference_steps_list (`list`, *opcional*, padrão `[10, 10, 10]`) : Número de etapas de inferência para cada estágio da pirâmide durante a geração do Estágio 2. | |
| use_zero_init (`bool`, *opcional*, padrão `True`) : Se deve aplicar a inicialização zero do CFG no início do desruido. | |
| zero_steps (`int`, *opcional*, padrão `1`) : Número de passos iniciais que usam CFG zero-init. | |
| is_amplify_first_chunk (`bool`, *opcional*, padrão `False`) : Se deve amplificar o guia no primeiro bloco (relacionado ao DMD). | |
| **Retorna:** `~HeliosPipelineOutput` ou `tuple` | |
| Se `return_dict` for `True`, `HeliosPipelineOutput` é retornado; caso contrário, uma `tuple` é retornada, em que o primeiro elemento é uma lista com as imagens geradas e o segundo elemento é uma lista de `bool`s indicando se a imagem gerada correspondente contém conteúdo "not-safe-for-work" (nsfw). | |
| A função de chamada do pipeline para geração. | |
| Exemplos: | |
| ```python | |
| >>> 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]] | |
| ```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) | |
| ``` | |
| [Fonte](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/helios/pipeline_helios_pyramid.py#L214) | |
| **Parâmetros:** | |
| prompt (`str` ou `list[str]`, *opcional*) : prompt a ser codificado | |
| negative_prompt (`str` ou `list[str]`, *opcional*) : O prompt ou os prompts que não devem orientar a geração da imagem. Se não definido, é necessário passar `negative_prompt_embeds` em vez disso. Ignorado quando não se usa orientação (ou seja, ignorado se `guidance_scale` for menor que `1`). | |
| do_classifier_free_guidance (`bool`, *opcional*, padrão `True`) : Se deve ou não usar classifier free guidance. | |
| num_videos_per_prompt (`int`, *opcional*, padrão 1) : Número de vídeos que devem ser gerados por prompt. Dispositivo torch para colocar os embeddings resultantes | |
| prompt_embeds (`torch.Tensor`, *opcional*) : Embeddings de texto pré-gerados. Podem ser usados para ajustar facilmente as entradas de texto, *por exemplo*, ponderação de prompts. Se não forem fornecidos, os embeddings de texto serão gerados a partir do argumento de entrada `prompt`. | |
| negative_prompt_embeds (`torch.Tensor`, *opcional*) : Embeddings de texto negativos pré-gerados. Podem ser usados para ajustar facilmente as entradas de texto, *por exemplo*, ponderação de prompts. Se não forem fornecidos, negative_prompt_embeds será gerado a partir do argumento de entrada `negative_prompt`. | |
| device : (`torch.device`, *opcional*): dispositivo torch | |
| dtype : (`torch.dtype`, *opcional*): dtype do torch | |
| Codifica o prompt em estados ocultos do codificador de texto. | |
| ## HeliosPipelineOutput[[diffusers.pipelines.helios.pipeline_output.HeliosPipelineOutput]] | |
| #### diffusers.pipelines.helios.pipeline_output.HeliosPipelineOutput[[diffusers.pipelines.helios.pipeline_output.HeliosPipelineOutput]] | |
| ```python | |
| diffusers.pipelines.helios.pipeline_output.HeliosPipelineOutput(frames: Tensor) | |
| ``` | |
| [Fonte](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/helios/pipeline_output.py#L9) | |
| **Parâmetros:** | |
| frames (`torch.Tensor`, `np.ndarray` ou List[List[PIL.Image.Image]]) : Lista de saídas de vídeo - Pode ser uma lista aninhada de comprimento `batch_size,` em que cada sublista contém sequências de imagens PIL desruidas de comprimento `num_frames.` Também pode ser um array NumPy ou um tensor Torch de forma `(batch_size, num_frames, channels, height, width)`. | |
| Classe de saída para pipelines do Helios. | |
Xet Storage Details
- Size:
- 54.5 kB
- Xet hash:
- e90152b66ea55f06a958ecdcf556c4dd7f108fcac03e8fa701939a86e336f51e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.