Buckets:

mishig's picture
|
download
raw
8.49 kB
#
# Apache Lisansı, 2.0 Sürümü ("Lisans") altında lisanslanmıştır;
# bu dosyayı, Lisansa uygun olarak kullanabilirsiniz.
# Lisansın bir kopyasını şu adresten edinebilirsiniz
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Uygulanabilir yasa gerektirmedikçe veya yazılı olarak anlaşılmadıkça, yazılım
# Lisans kapsamında dağıtılan, "OLDUĞU GİBİ" esasına göre dağıtılır,
# HİÇBİR TÜR AÇIK VEYA ZIMMİ GARANTİ VEYA ŞART İÇERMEZ.
# İzinleri ve
# lisans kapsamındaki kısıtlamalar. -->
# Echo
[Echo](https://github.com/jd-opensource/JoyAI-Echo), uzun video üretimi modeli. İsteğe bağlı temiz ilk kare, sıralı görsel/ses bellek yuvaları ve stokastik az adımlı Dağılım Eşleştirme Damıtma (DMD) örnekleyiciyi destekler. Boru hattı, senkronize video ve ses üretir.
Echo, [ModularPipeline](/docs/diffusers/main/tr/api/modular_diffusers/pipeline#diffusers.ModularPipeline) olarak uygulandığından metin kodlama, bellek koşullandırma, stokastik DMD gürültü azaltma ve çözümleme blokları tam bir iş akışı olarak çalıştırılabilir veya bağımsız olarak birleştirilebilir.
## Çıkarım
Resmi [jdopensource/JoyAI-Echo](https://huggingface.co/jdopensource/JoyAI-Echo) kontrol noktasını doğrudan yükleyin. Metin kodlayıcı ve belirteçleyici olarak [google/gemma-3-12b-it](https://huggingface.co/google/gemma-3-12b-it)'denkullanır. Gemma deposu kapalı olduğundan, pipeline'ı yüklemesinden önce lisansını kabul edin ve Hugging Face ile kimlik doğrulaması yapın.
Yayınlanan model, uzun video örneğinde 241 kare kullanır. Video RoPE koordinatları, çıktı kapsayıcısının hızından bağımsız olarak 24 fps eğitim hızında kalır.
```py
import torch
import torchaudio
from PIL import Image
from diffusers import ComponentsManager, ModularPipeline
from diffusers.utils import encode_video
manager = ComponentsManager()
pipe = ModularPipeline.from_pretrained("jdopensource/JoyAI-Echo", components_manager=manager)
pipe.load_components(dtype={"default": torch.bfloat16, "audio_vae": torch.float32})
manager.enable_auto_cpu_offload(device="cuda")
pipe.vae.enable_tiling()
first_frame = Image.open("first_frame.png").convert("RGB")
memory_images = [Image.open(path).convert("RGB") for path in ["memory_0.png", "memory_1.png"]]
memory_audio_with_rates = [torchaudio.load(path) for path in ["memory_0.wav", "memory_1.wav"]]
memory_audio = [waveform for waveform, _ in memory_audio_with_rates]
memory_audio_rates = [sample_rate for _, sample_rate in memory_audio_with_rates]
output = pipe(
prompt="A cinematic dialogue scene in a quiet cafe.",
image=first_frame,
memory_images=memory_images,
memory_audio_waveforms=memory_audio,
memory_audio_sample_rates=memory_audio_rates,
width=1280,
height=736,
num_frames=241,
frame_rate=25.0,
model_frame_rate=24.0,
generator=torch.Generator(device="cuda").manual_seed(42),
output_type="np",
output=["videos", "audio"],
)
encode_video(
output["videos"][0],
fps=25,
audio=output["audio"][0].float().cpu(),
audio_sample_rate=pipe.vocoder.config.output_sampling_rate,
output_path="echo.mp4",
)
```
Varsayılan DMD sigma zamanlaması, yayımlanan sekiz adımlı zamanlamadır. Her adımda `x0` tahmin eder ve bir sonraki sigmada taze Gauss gürültüsüyle yeniden gürültüler; bu nedenle tohumlanmış bir `torch.Generator`, hem başlangıç gürültüsünü hem de tüm ara yeniden gürültüleme işlemlerini kontrol eder.
Ham ses-bellek kodlaması `torchaudio` gerektirir. Referans uyumu için, yukarıda gösterildiği gibi `audio_vae` bileşenini FP32 olarak tutun. Modüler iş akışları, VAE kodlayıcısının normalize edilmiş, paketlenmemiş tensörlerini önbelleğe alabilir. Video latentleri `(batch, channels, frames, height, width)` biçiminde, ses latentleri ise `(batch, channels, time, mel_bins)` biçimindedir. Çekirdek `denoise` bloğu bu tensörleri paketler, `num_videos_per_prompt` için koşullandırmayı genişletir ve gürültüden arındırılmış çıktıları aynı VAE biçimine geri paketler. Başlangıç `latents` ve `audio_latents` değerlerini de bu paketlenmemiş biçimde iletin. Çözücüler, normalize edilmiş VAE tensörlerini alır ve çözümleme işleminden hemen önce bunları normalleştirme dışı hale getirir. `output=["latents", "audio_latents"]` parametresi normalize edilmiş VAE tensörlerini döndürür. `output_type="latent"` ve `output=["videos", "audio"]` kullanıldığında, çözümleme yapılmadan normalleştirme dışı VAE tensörlerini alırsınız.
## EchoModularPipeline[[diffusers.EchoModularPipeline]]
#### diffusers.EchoModularPipeline[[diffusers.EchoModularPipeline]]
```python
diffusers.EchoModularPipeline(blocks: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None, pretrained_model_name_or_path: str | os.PathLike | None = None, components_manager: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None, collection: str | None = None, workflow: str | None = None, modular_config_dict: dict[str, typing.Any] | None = None, config_dict: dict[str, typing.Any] | None = None, **kwargs)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/echo/modular_pipeline.py#L27)
Echo uzun video DMD kontrol noktası için bir ModularPipeline.
## EchoBlocks[[diffusers.EchoBlocks]]
#### diffusers.EchoBlocks[[diffusers.EchoBlocks]]
```python
diffusers.EchoBlocks()
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/echo/modular_blocks_echo.py#L220)
Temiz ilk kare koşullandırması, sıralı görüntü/ses bellek yuvaları ve stokastik DMD gürültü azaltma ile Echo referans-vidyo üretimi.
Bileşenler: text_encoder (`PreTrainedModel`) tokenizer (`PreTrainedTokenizerBase`) connectors (`LTX2TextConnectors`) vae (`AutoencoderKLLTX2Video`) audio_vae (`AutoencoderKLLTX2Audio`) transformer (`LTX2VideoTransformer3DModel`) video_processor (`VideoProcessor`) vocoder (`LTX2Vocoder`)
Inputs: prompt (`str`): The prompt or prompts to guide image generation. max_sequence_length (`int`, *optional*, defaults to 1024): Maximum sequence length for prompt encoding. image (`Image | Tensor`, *optional*): Optional single first frame used as a clean reference condition. memory_images (`list`, *optional*): Ordered reference images, one per Echo memory slot. memory_audio_waveforms (`list`, *optional*): Ordered memory waveforms as `(channels, samples)` tensors. Inputs longer than 9.62 seconds are cropped to their highest-response window. Use `None` for a silent slot. memory_audio_sample_rates (`int | list`, *optional*): Sampling rate shared by all memory waveforms, or one rate per slot. height (`int`, *optional*, defaults to 512): The height in pixels of the generated image. width (`int`, *optional*, defaults to 704): The width in pixels of the generated image. model_frame_rate (`float`, *optional*, defaults to 24.0): Training-time frame rate used for Echo video RoPE coordinates. memory_position_offset (`float`, *optional*, defaults to 500.0): Temporal center assigned to the first memory slot. memory_position_slot_stride (`float`, *optional*, defaults to 50.0): Temporal distance between consecutive memory-slot centers. num_videos_per_prompt (`int`, *optional*, defaults to 1): Number of videos per prompt. num_frames (`int`, *optional*, defaults to 241): Number of generated pixel frames; must be `1 + k * vae_temporal_compression_ratio`. frame_rate (`float`, *optional*, defaults to 25.0): Frame rate of the generated video. latents (`Tensor`, *optional*): Optional initial video noise in VAE form (B, C, F, H, W). audio_latents (`Tensor`, *optional*): Optional initial audio noise in VAE form (B, C, L, M). generator (`Generator`, *optional*): Torch generator for deterministic generation. sigmas (`list | tuple`): DMD sigma schedule, including the terminal zero. attention_kwargs (`dict`, *optional*): Additional kwargs for attention processors. output_type (`str`, *optional*, defaults to pil): Output format: 'pil', 'np', 'pt'. decode_timestep (`None`, *optional*, defaults to 0.0): Timestep used to decode the final latents. decode_noise_scale (`None`, *optional*): Noise interpolation factor applied at the decode timestep.
Çıktılar: videos (`list`): Oluşturulan videolar. audio (`Tensor`): Oluşturulan ses dalgası.

Xet Storage Details

Size:
8.49 kB
·
Xet hash:
101f146347766f257740569c046bc85fefa3cedf81e859f32a8c9373fe0cad5a

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