Upload folder using huggingface_hub (part 6)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-I2AV-TwoStage.py +71 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-DistilledPipeline.py +58 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-IC-LoRA-Motion-Track-Control.py +72 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-IC-LoRA-Union-Control.py +69 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-OneStage.py +43 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-TwoStage-Retake.py +78 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-TwoStage.py +58 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/full/JoyAI-Echo-T2AV-splited.sh +37 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/full/LTX-2-T2AV-splited.sh +37 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/full/LTX-2.3-I2AV-splited.sh +37 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/full/LTX-2.3-T2AV-splited.sh +37 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/JoyAI-Echo-T2AV-splited.sh +41 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2-T2AV-IC-LoRA-splited.sh +41 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2-T2AV-noaudio.sh +58 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2-T2AV-splited.sh +62 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2.3-I2AV-splited.sh +41 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2.3-T2AV-IC-LoRA-splited.sh +41 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2.3-T2AV-splited.sh +41 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/scripts/split_model_statedicts.py +104 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/scripts/split_model_statedicts_ltx2.3.py +102 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/train.py +188 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_full/JoyAI-Echo-T2AV.py +51 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_full/LTX-2-T2AV.py +47 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_full/LTX-2.3-I2AV.py +54 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_full/LTX-2.3-T2AV.py +47 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/JoyAI-Echo-T2AV.py +49 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2-T2AV-IC-LoRA.py +56 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2-T2AV.py +48 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2-T2AV_noaudio.py +48 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2.3-I2AV.py +56 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2.3-T2AV-IC-LoRA.py +56 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2.3-T2AV.py +48 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/README.md +3 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/acceleration/unified_sequence_parallel.py +55 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_inference/MOVA-360p-I2AV.py +52 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_inference/MOVA-720p-I2AV.py +52 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_inference_low_vram/MOVA-360p-I2AV.py +53 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_inference_low_vram/MOVA-720p-I2AV.py +53 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/full/MOVA-360P-I2AV.sh +41 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/full/MOVA-720P-I2AV.sh +41 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/lora/MOVA-360P-I2AV.sh +45 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/lora/MOVA-720P-I2AV.sh +45 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/train.py +202 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/validate_full/MOVA-360p-I2AV.py +53 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/validate_full/MOVA-720p-I2AV.py +54 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/validate_lora/MOVA-360p-I2AV.py +54 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/validate_lora/MOVA-720p-I2AV.py +54 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/qwen_image/README.md +3 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/qwen_image/model_inference/FireRed-Image-Edit-1.0.py +43 -0
- video_gen_14d/third_party/DiffSynth-Studio/examples/qwen_image/model_inference/FireRed-Image-Edit-1.1.py +43 -0
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-I2AV-TwoStage.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
from PIL import Image
|
| 5 |
+
from modelscope import dataset_snapshot_download
|
| 6 |
+
|
| 7 |
+
vram_config = {
|
| 8 |
+
"offload_dtype": torch.float8_e5m2,
|
| 9 |
+
"offload_device": "cpu",
|
| 10 |
+
"onload_dtype": torch.float8_e5m2,
|
| 11 |
+
"onload_device": "cpu",
|
| 12 |
+
"preparing_dtype": torch.float8_e5m2,
|
| 13 |
+
"preparing_device": "cuda",
|
| 14 |
+
"computation_dtype": torch.bfloat16,
|
| 15 |
+
"computation_device": "cuda",
|
| 16 |
+
}
|
| 17 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 18 |
+
torch_dtype=torch.bfloat16,
|
| 19 |
+
device="cuda",
|
| 20 |
+
model_configs=[
|
| 21 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-dev.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-spatial-upscaler-x2-1.0.safetensors", **vram_config),
|
| 24 |
+
],
|
| 25 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 26 |
+
stage2_lora_config=ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-distilled-lora-384.safetensors"),
|
| 27 |
+
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 0.5,
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
prompt = "A girl is very happy, she is speaking: “I enjoy working with Diffsynth-Studio, it's a perfect framework.”"
|
| 31 |
+
negative_prompt = (
|
| 32 |
+
"blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, "
|
| 33 |
+
"grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, "
|
| 34 |
+
"deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, "
|
| 35 |
+
"wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of "
|
| 36 |
+
"field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent "
|
| 37 |
+
"lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny "
|
| 38 |
+
"valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, "
|
| 39 |
+
"mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, "
|
| 40 |
+
"off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward "
|
| 41 |
+
"pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, "
|
| 42 |
+
"inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 43 |
+
)
|
| 44 |
+
height, width, num_frames = 512 * 2, 768 * 2, 121
|
| 45 |
+
dataset_snapshot_download(
|
| 46 |
+
dataset_id="DiffSynth-Studio/examples_in_diffsynth",
|
| 47 |
+
local_dir="./",
|
| 48 |
+
allow_file_pattern=["data/examples/ltx-2/first_frame.jpg"]
|
| 49 |
+
)
|
| 50 |
+
image = Image.open("data/examples/ltx-2/first_frame.jpg").convert("RGB").resize((width, height))
|
| 51 |
+
# first frame
|
| 52 |
+
video, audio = pipe(
|
| 53 |
+
prompt=prompt,
|
| 54 |
+
negative_prompt=negative_prompt,
|
| 55 |
+
seed=42,
|
| 56 |
+
height=height,
|
| 57 |
+
width=width,
|
| 58 |
+
num_frames=num_frames,
|
| 59 |
+
tiled=True,
|
| 60 |
+
use_two_stage_pipeline=True,
|
| 61 |
+
input_images=[image],
|
| 62 |
+
input_images_indexes=[0],
|
| 63 |
+
input_images_strength=1.0,
|
| 64 |
+
)
|
| 65 |
+
write_video_audio_ltx2(
|
| 66 |
+
video=video,
|
| 67 |
+
audio=audio,
|
| 68 |
+
output_path='ltx2.3_twostage_i2av_first.mp4',
|
| 69 |
+
fps=24,
|
| 70 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 71 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-DistilledPipeline.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
|
| 5 |
+
vram_config = {
|
| 6 |
+
"offload_dtype": torch.float8_e5m2,
|
| 7 |
+
"offload_device": "cpu",
|
| 8 |
+
"onload_dtype": torch.float8_e5m2,
|
| 9 |
+
"onload_device": "cpu",
|
| 10 |
+
"preparing_dtype": torch.float8_e5m2,
|
| 11 |
+
"preparing_device": "cuda",
|
| 12 |
+
"computation_dtype": torch.bfloat16,
|
| 13 |
+
"computation_device": "cuda",
|
| 14 |
+
}
|
| 15 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 16 |
+
torch_dtype=torch.bfloat16,
|
| 17 |
+
device="cuda",
|
| 18 |
+
model_configs=[
|
| 19 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 20 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-distilled.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-spatial-upscaler-x2-1.0.safetensors", **vram_config),
|
| 22 |
+
],
|
| 23 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 24 |
+
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 0.5,
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
prompt = "A girl is very happy, she is speaking: “I enjoy working with Diffsynth-Studio, it's a perfect framework.”"
|
| 28 |
+
negative_prompt = (
|
| 29 |
+
"blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, "
|
| 30 |
+
"grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, "
|
| 31 |
+
"deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, "
|
| 32 |
+
"wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of "
|
| 33 |
+
"field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent "
|
| 34 |
+
"lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny "
|
| 35 |
+
"valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, "
|
| 36 |
+
"mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, "
|
| 37 |
+
"off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward "
|
| 38 |
+
"pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, "
|
| 39 |
+
"inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 40 |
+
)
|
| 41 |
+
height, width, num_frames = 512 * 2, 768 * 2, 121
|
| 42 |
+
video, audio = pipe(
|
| 43 |
+
prompt=prompt,
|
| 44 |
+
negative_prompt=negative_prompt,
|
| 45 |
+
seed=43,
|
| 46 |
+
height=height,
|
| 47 |
+
width=width,
|
| 48 |
+
num_frames=num_frames,
|
| 49 |
+
tiled=True,
|
| 50 |
+
use_distilled_pipeline=True,
|
| 51 |
+
)
|
| 52 |
+
write_video_audio_ltx2(
|
| 53 |
+
video=video,
|
| 54 |
+
audio=audio,
|
| 55 |
+
output_path='ltx2.3_distilled.mp4',
|
| 56 |
+
fps=24,
|
| 57 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 58 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-IC-LoRA-Motion-Track-Control.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
from modelscope import dataset_snapshot_download
|
| 5 |
+
from diffsynth.utils.data import VideoData
|
| 6 |
+
|
| 7 |
+
vram_config = {
|
| 8 |
+
"offload_dtype": torch.float8_e5m2,
|
| 9 |
+
"offload_device": "cpu",
|
| 10 |
+
"onload_dtype": torch.float8_e5m2,
|
| 11 |
+
"onload_device": "cpu",
|
| 12 |
+
"preparing_dtype": torch.float8_e5m2,
|
| 13 |
+
"preparing_device": "cuda",
|
| 14 |
+
"computation_dtype": torch.bfloat16,
|
| 15 |
+
"computation_device": "cuda",
|
| 16 |
+
}
|
| 17 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 18 |
+
torch_dtype=torch.bfloat16,
|
| 19 |
+
device="cuda",
|
| 20 |
+
model_configs=[
|
| 21 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-dev.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-spatial-upscaler-x2-1.0.safetensors", **vram_config),
|
| 24 |
+
],
|
| 25 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 26 |
+
stage2_lora_config=ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-distilled-lora-384.safetensors"),
|
| 27 |
+
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 0.5,
|
| 28 |
+
)
|
| 29 |
+
pipe.load_lora(pipe.dit, ModelConfig(model_id="Lightricks/LTX-2.3-22b-IC-LoRA-Motion-Track-Control", origin_file_pattern="ltx-2.3-22b-ic-lora-motion-track-control-ref0.5.safetensors"))
|
| 30 |
+
dataset_snapshot_download("DiffSynth-Studio/example_video_dataset", allow_file_pattern="ltx2/*", local_dir="data/example_video_dataset")
|
| 31 |
+
prompt = "[VISUAL]:Two cute orange cats, wearing boxing gloves, stand on a boxing ring and fight each other. [SOUNDS]:the sound of two cats boxing"
|
| 32 |
+
negative_prompt = (
|
| 33 |
+
"blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, "
|
| 34 |
+
"grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, "
|
| 35 |
+
"deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, "
|
| 36 |
+
"wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of "
|
| 37 |
+
"field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent "
|
| 38 |
+
"lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny "
|
| 39 |
+
"valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, "
|
| 40 |
+
"mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, "
|
| 41 |
+
"off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward "
|
| 42 |
+
"pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, "
|
| 43 |
+
"inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 44 |
+
)
|
| 45 |
+
height, width, num_frames = 512 * 2, 768 * 2, 121
|
| 46 |
+
ref_scale_factor = 2
|
| 47 |
+
frame_rate = 24
|
| 48 |
+
input_image = VideoData("data/example_video_dataset/ltx2/video1.mp4", height=height // ref_scale_factor // 2, width=width // ref_scale_factor // 2)[0]
|
| 49 |
+
input_video = VideoData("data/example_video_dataset/ltx2/spatial_tracker_v2.mp4", height=height // ref_scale_factor // 2, width=width // ref_scale_factor // 2).raw_data()
|
| 50 |
+
video, audio = pipe(
|
| 51 |
+
prompt=prompt,
|
| 52 |
+
negative_prompt=negative_prompt,
|
| 53 |
+
seed=43,
|
| 54 |
+
height=height,
|
| 55 |
+
width=width,
|
| 56 |
+
num_frames=num_frames,
|
| 57 |
+
frame_rate=frame_rate,
|
| 58 |
+
in_context_videos=[input_video],
|
| 59 |
+
in_context_downsample_factor=ref_scale_factor,
|
| 60 |
+
input_images=[input_image],
|
| 61 |
+
input_images_indexes=[0],
|
| 62 |
+
tiled=True,
|
| 63 |
+
use_two_stage_pipeline=True,
|
| 64 |
+
clear_lora_before_state_two=True,
|
| 65 |
+
)
|
| 66 |
+
write_video_audio_ltx2(
|
| 67 |
+
video=video,
|
| 68 |
+
audio=audio,
|
| 69 |
+
output_path='ltx2.3_ic_lora.mp4',
|
| 70 |
+
fps=frame_rate,
|
| 71 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 72 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-IC-LoRA-Union-Control.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
from modelscope import dataset_snapshot_download
|
| 5 |
+
from diffsynth.utils.data import VideoData
|
| 6 |
+
|
| 7 |
+
vram_config = {
|
| 8 |
+
"offload_dtype": torch.float8_e5m2,
|
| 9 |
+
"offload_device": "cpu",
|
| 10 |
+
"onload_dtype": torch.float8_e5m2,
|
| 11 |
+
"onload_device": "cpu",
|
| 12 |
+
"preparing_dtype": torch.float8_e5m2,
|
| 13 |
+
"preparing_device": "cuda",
|
| 14 |
+
"computation_dtype": torch.bfloat16,
|
| 15 |
+
"computation_device": "cuda",
|
| 16 |
+
}
|
| 17 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 18 |
+
torch_dtype=torch.bfloat16,
|
| 19 |
+
device="cuda",
|
| 20 |
+
model_configs=[
|
| 21 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-dev.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-spatial-upscaler-x2-1.0.safetensors", **vram_config),
|
| 24 |
+
],
|
| 25 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 26 |
+
stage2_lora_config=ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-distilled-lora-384.safetensors"),
|
| 27 |
+
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 0.5,
|
| 28 |
+
)
|
| 29 |
+
pipe.load_lora(pipe.dit, ModelConfig(model_id="Lightricks/LTX-2.3-22b-IC-LoRA-Union-Control", origin_file_pattern="ltx-2.3-22b-ic-lora-union-control-ref0.5.safetensors"))
|
| 30 |
+
dataset_snapshot_download("DiffSynth-Studio/example_video_dataset", allow_file_pattern="ltx2/*", local_dir="data/example_video_dataset")
|
| 31 |
+
prompt = "[VISUAL]:Two cute orange cats, wearing boxing gloves, stand on a boxing ring and fight each other. [SOUNDS]:the sound of two cats boxing"
|
| 32 |
+
negative_prompt = (
|
| 33 |
+
"blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, "
|
| 34 |
+
"grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, "
|
| 35 |
+
"deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, "
|
| 36 |
+
"wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of "
|
| 37 |
+
"field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent "
|
| 38 |
+
"lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny "
|
| 39 |
+
"valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, "
|
| 40 |
+
"mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, "
|
| 41 |
+
"off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward "
|
| 42 |
+
"pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, "
|
| 43 |
+
"inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 44 |
+
)
|
| 45 |
+
height, width, num_frames = 512 * 2, 768 * 2, 121
|
| 46 |
+
ref_scale_factor = 2
|
| 47 |
+
frame_rate = 24
|
| 48 |
+
input_video = VideoData("data/example_video_dataset/ltx2/depth_video.mp4", height=height // ref_scale_factor // 2, width=width // ref_scale_factor // 2).raw_data()
|
| 49 |
+
video, audio = pipe(
|
| 50 |
+
prompt=prompt,
|
| 51 |
+
negative_prompt=negative_prompt,
|
| 52 |
+
seed=43,
|
| 53 |
+
height=height,
|
| 54 |
+
width=width,
|
| 55 |
+
num_frames=num_frames,
|
| 56 |
+
frame_rate=frame_rate,
|
| 57 |
+
in_context_videos=[input_video],
|
| 58 |
+
in_context_downsample_factor=ref_scale_factor,
|
| 59 |
+
tiled=True,
|
| 60 |
+
use_two_stage_pipeline=True,
|
| 61 |
+
clear_lora_before_state_two=True,
|
| 62 |
+
)
|
| 63 |
+
write_video_audio_ltx2(
|
| 64 |
+
video=video,
|
| 65 |
+
audio=audio,
|
| 66 |
+
output_path='ltx2.3_ic_lora.mp4',
|
| 67 |
+
fps=frame_rate,
|
| 68 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 69 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-OneStage.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
|
| 5 |
+
vram_config = {
|
| 6 |
+
"offload_dtype": torch.float8_e5m2,
|
| 7 |
+
"offload_device": "cpu",
|
| 8 |
+
"onload_dtype": torch.float8_e5m2,
|
| 9 |
+
"onload_device": "cpu",
|
| 10 |
+
"preparing_dtype": torch.float8_e5m2,
|
| 11 |
+
"preparing_device": "cuda",
|
| 12 |
+
"computation_dtype": torch.bfloat16,
|
| 13 |
+
"computation_device": "cuda",
|
| 14 |
+
}
|
| 15 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 16 |
+
torch_dtype=torch.bfloat16,
|
| 17 |
+
device="cuda",
|
| 18 |
+
model_configs=[
|
| 19 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 20 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-dev.safetensors", **vram_config),
|
| 21 |
+
],
|
| 22 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 23 |
+
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 0.5,
|
| 24 |
+
)
|
| 25 |
+
prompt = "A girl is very happy, she is speaking: “I enjoy working with Diffsynth-Studio, it's a perfect framework.”"
|
| 26 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 27 |
+
height, width, num_frames = 512, 768, 121
|
| 28 |
+
video, audio = pipe(
|
| 29 |
+
prompt=prompt,
|
| 30 |
+
negative_prompt=negative_prompt,
|
| 31 |
+
seed=43,
|
| 32 |
+
height=height,
|
| 33 |
+
width=width,
|
| 34 |
+
num_frames=num_frames,
|
| 35 |
+
tiled=True,
|
| 36 |
+
)
|
| 37 |
+
write_video_audio_ltx2(
|
| 38 |
+
video=video,
|
| 39 |
+
audio=audio,
|
| 40 |
+
output_path='ltx2.3_onestage.mp4',
|
| 41 |
+
fps=24,
|
| 42 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 43 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-TwoStage-Retake.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
from diffsynth.utils.data.audio import read_audio
|
| 5 |
+
from modelscope import dataset_snapshot_download
|
| 6 |
+
from diffsynth.utils.data import VideoData
|
| 7 |
+
|
| 8 |
+
vram_config = {
|
| 9 |
+
"offload_dtype": torch.float8_e5m2,
|
| 10 |
+
"offload_device": "cpu",
|
| 11 |
+
"onload_dtype": torch.float8_e5m2,
|
| 12 |
+
"onload_device": "cpu",
|
| 13 |
+
"preparing_dtype": torch.float8_e5m2,
|
| 14 |
+
"preparing_device": "cuda",
|
| 15 |
+
"computation_dtype": torch.bfloat16,
|
| 16 |
+
"computation_device": "cuda",
|
| 17 |
+
}
|
| 18 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 19 |
+
torch_dtype=torch.bfloat16,
|
| 20 |
+
device="cuda",
|
| 21 |
+
model_configs=[
|
| 22 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-dev.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-spatial-upscaler-x2-1.0.safetensors", **vram_config),
|
| 25 |
+
],
|
| 26 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 27 |
+
stage2_lora_config=ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-distilled-lora-384.safetensors"),
|
| 28 |
+
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 0.5,
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
dataset_snapshot_download("DiffSynth-Studio/example_video_dataset", allow_file_pattern="ltx2/*", local_dir="data/example_video_dataset")
|
| 32 |
+
prompt = "A beautiful woman with a flower crown is singing happily under a blooming cherry tree. She sings: 'Mummy don't know daddy's getting hot. At the body shop'"
|
| 33 |
+
negative_prompt = (
|
| 34 |
+
"blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, "
|
| 35 |
+
"grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, "
|
| 36 |
+
"deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, "
|
| 37 |
+
"wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of "
|
| 38 |
+
"field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent "
|
| 39 |
+
"lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny "
|
| 40 |
+
"valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, "
|
| 41 |
+
"mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, "
|
| 42 |
+
"off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward "
|
| 43 |
+
"pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, "
|
| 44 |
+
"inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
height, width, num_frames, frame_rate = 512 * 2, 768 * 2, 121, 24
|
| 48 |
+
path = "data/example_video_dataset/ltx2/video2.mp4"
|
| 49 |
+
video = VideoData(path, height=height, width=width).raw_data()[:num_frames]
|
| 50 |
+
assert len(video) == num_frames, f"Input video has {len(video)} frames, but expected {num_frames} frames based on the specified num_frames argument."
|
| 51 |
+
duration = num_frames / frame_rate
|
| 52 |
+
audio, audio_sample_rate = read_audio(path)
|
| 53 |
+
|
| 54 |
+
# Regenerate the video within time regions. You can specify different time regions for video frames and audio retake.
|
| 55 |
+
# retake regions are in seconds, and the example below retakes video frames in the time regions of [1s, 2s] and [3s, 4s], and retakes audio in the time regions of [0s, 1s] and [4s, 5s].
|
| 56 |
+
video, audio = pipe(
|
| 57 |
+
prompt=prompt,
|
| 58 |
+
negative_prompt=negative_prompt,
|
| 59 |
+
retake_video=video,
|
| 60 |
+
retake_video_regions=[(1, 2), (3, 4)],
|
| 61 |
+
retake_audio=audio,
|
| 62 |
+
audio_sample_rate=audio_sample_rate,
|
| 63 |
+
retake_audio_regions=[(0, 1), (4, 5)],
|
| 64 |
+
seed=43,
|
| 65 |
+
height=height,
|
| 66 |
+
width=width,
|
| 67 |
+
num_frames=num_frames,
|
| 68 |
+
frame_rate=frame_rate,
|
| 69 |
+
tiled=True,
|
| 70 |
+
use_two_stage_pipeline=True,
|
| 71 |
+
)
|
| 72 |
+
write_video_audio_ltx2(
|
| 73 |
+
video=video,
|
| 74 |
+
audio=audio,
|
| 75 |
+
output_path='ltx2.3_twostage_retake.mp4',
|
| 76 |
+
fps=frame_rate,
|
| 77 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 78 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_inference_low_vram/LTX-2.3-T2AV-TwoStage.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
|
| 5 |
+
vram_config = {
|
| 6 |
+
"offload_dtype": torch.float8_e5m2,
|
| 7 |
+
"offload_device": "cpu",
|
| 8 |
+
"onload_dtype": torch.float8_e5m2,
|
| 9 |
+
"onload_device": "cpu",
|
| 10 |
+
"preparing_dtype": torch.float8_e5m2,
|
| 11 |
+
"preparing_device": "cuda",
|
| 12 |
+
"computation_dtype": torch.bfloat16,
|
| 13 |
+
"computation_device": "cuda",
|
| 14 |
+
}
|
| 15 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 16 |
+
torch_dtype=torch.bfloat16,
|
| 17 |
+
device="cuda",
|
| 18 |
+
model_configs=[
|
| 19 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 20 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-dev.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-spatial-upscaler-x2-1.0.safetensors", **vram_config),
|
| 22 |
+
],
|
| 23 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 24 |
+
stage2_lora_config=ModelConfig(model_id="Lightricks/LTX-2.3", origin_file_pattern="ltx-2.3-22b-distilled-lora-384.safetensors"),
|
| 25 |
+
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 0.5,
|
| 26 |
+
)
|
| 27 |
+
prompt = "A girl is very happy, she is speaking: “I enjoy working with Diffsynth-Studio, it's a perfect framework.”"
|
| 28 |
+
negative_prompt = (
|
| 29 |
+
"blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, "
|
| 30 |
+
"grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, "
|
| 31 |
+
"deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, "
|
| 32 |
+
"wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of "
|
| 33 |
+
"field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent "
|
| 34 |
+
"lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny "
|
| 35 |
+
"valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, "
|
| 36 |
+
"mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, "
|
| 37 |
+
"off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward "
|
| 38 |
+
"pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, "
|
| 39 |
+
"inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 40 |
+
)
|
| 41 |
+
height, width, num_frames = 512 * 2, 768 * 2, 121
|
| 42 |
+
video, audio = pipe(
|
| 43 |
+
prompt=prompt,
|
| 44 |
+
negative_prompt=negative_prompt,
|
| 45 |
+
seed=43,
|
| 46 |
+
height=height,
|
| 47 |
+
width=width,
|
| 48 |
+
num_frames=num_frames,
|
| 49 |
+
tiled=True,
|
| 50 |
+
use_two_stage_pipeline=True,
|
| 51 |
+
)
|
| 52 |
+
write_video_audio_ltx2(
|
| 53 |
+
video=video,
|
| 54 |
+
audio=audio,
|
| 55 |
+
output_path='ltx2.3_twostage.mp4',
|
| 56 |
+
fps=24,
|
| 57 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 58 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/full/JoyAI-Echo-T2AV-splited.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2.3-T2AV-splited/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# Splited Training
|
| 4 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2.3-T2AV-splited \
|
| 6 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2.3-T2AV-splited/metadata.csv \
|
| 7 |
+
--data_file_keys "video,input_audio" \
|
| 8 |
+
--extra_inputs "input_audio" \
|
| 9 |
+
--height 512 \
|
| 10 |
+
--width 768 \
|
| 11 |
+
--num_frames 121 \
|
| 12 |
+
--dataset_repeat 1 \
|
| 13 |
+
--model_id_with_origin_paths "jd-opensource/JoyAI-Echo:JoyAI-Echo-release.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 14 |
+
--learning_rate 1e-5 \
|
| 15 |
+
--num_epochs 5 \
|
| 16 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 17 |
+
--output_path "./models/train/JoyAI-Echo-T2AV-full-splited-cache" \
|
| 18 |
+
--trainable_models "dit" \
|
| 19 |
+
--use_gradient_checkpointing \
|
| 20 |
+
--task "sft:data_process"
|
| 21 |
+
|
| 22 |
+
accelerate launch --config_file examples/qwen_image/model_training/full/accelerate_config_zero2offload.yaml examples/ltx2/model_training/train.py \
|
| 23 |
+
--dataset_base_path ./models/train/JoyAI-Echo-T2AV-full-splited-cache \
|
| 24 |
+
--data_file_keys "video,input_audio" \
|
| 25 |
+
--extra_inputs "input_audio" \
|
| 26 |
+
--height 512 \
|
| 27 |
+
--width 768 \
|
| 28 |
+
--num_frames 121 \
|
| 29 |
+
--dataset_repeat 100 \
|
| 30 |
+
--model_id_with_origin_paths "jd-opensource/JoyAI-Echo:JoyAI-Echo-release.safetensors" \
|
| 31 |
+
--learning_rate 1e-5 \
|
| 32 |
+
--num_epochs 5 \
|
| 33 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 34 |
+
--output_path "./models/train/JoyAI-Echo-T2AV-full" \
|
| 35 |
+
--trainable_models "dit" \
|
| 36 |
+
--use_gradient_checkpointing \
|
| 37 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/full/LTX-2-T2AV-splited.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2-T2AV-splited/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# Splited Training
|
| 4 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-splited \
|
| 6 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-splited/metadata.csv \
|
| 7 |
+
--data_file_keys "video,input_audio" \
|
| 8 |
+
--extra_inputs "input_audio" \
|
| 9 |
+
--height 512 \
|
| 10 |
+
--width 768 \
|
| 11 |
+
--num_frames 121 \
|
| 12 |
+
--dataset_repeat 1 \
|
| 13 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 14 |
+
--learning_rate 1e-5 \
|
| 15 |
+
--num_epochs 5 \
|
| 16 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 17 |
+
--output_path "./models/train/LTX2-T2AV-full-splited-cache" \
|
| 18 |
+
--trainable_models "dit" \
|
| 19 |
+
--use_gradient_checkpointing \
|
| 20 |
+
--task "sft:data_process"
|
| 21 |
+
|
| 22 |
+
accelerate launch --config_file examples/qwen_image/model_training/full/accelerate_config_zero2offload.yaml examples/ltx2/model_training/train.py \
|
| 23 |
+
--dataset_base_path ./models/train/LTX2-T2AV-full-splited-cache \
|
| 24 |
+
--data_file_keys "video,input_audio" \
|
| 25 |
+
--extra_inputs "input_audio" \
|
| 26 |
+
--height 512 \
|
| 27 |
+
--width 768 \
|
| 28 |
+
--num_frames 121 \
|
| 29 |
+
--dataset_repeat 100 \
|
| 30 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2-Repackage:transformer.safetensors" \
|
| 31 |
+
--learning_rate 1e-5 \
|
| 32 |
+
--num_epochs 5 \
|
| 33 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 34 |
+
--output_path "./models/train/LTX2-T2AV-full" \
|
| 35 |
+
--trainable_models "dit" \
|
| 36 |
+
--use_gradient_checkpointing \
|
| 37 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/full/LTX-2.3-I2AV-splited.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2.3-I2AV-splited/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# Splited Training
|
| 4 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2.3-I2AV-splited \
|
| 6 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2.3-I2AV-splited/metadata.csv \
|
| 7 |
+
--data_file_keys "video,input_audio" \
|
| 8 |
+
--extra_inputs "input_audio,input_image" \
|
| 9 |
+
--height 512 \
|
| 10 |
+
--width 768 \
|
| 11 |
+
--num_frames 121 \
|
| 12 |
+
--dataset_repeat 1 \
|
| 13 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2.3-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2.3-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2.3-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 14 |
+
--learning_rate 1e-5 \
|
| 15 |
+
--num_epochs 5 \
|
| 16 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 17 |
+
--output_path "./models/train/LTX2.3-I2AV-full-splited-cache" \
|
| 18 |
+
--trainable_models "dit" \
|
| 19 |
+
--use_gradient_checkpointing \
|
| 20 |
+
--task "sft:data_process"
|
| 21 |
+
|
| 22 |
+
accelerate launch --config_file examples/qwen_image/model_training/full/accelerate_config_zero2offload.yaml examples/ltx2/model_training/train.py \
|
| 23 |
+
--dataset_base_path ./models/train/LTX2.3-I2AV-full-splited-cache \
|
| 24 |
+
--data_file_keys "video,input_audio" \
|
| 25 |
+
--extra_inputs "input_audio,input_image" \
|
| 26 |
+
--height 512 \
|
| 27 |
+
--width 768 \
|
| 28 |
+
--num_frames 121 \
|
| 29 |
+
--dataset_repeat 100 \
|
| 30 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2.3-Repackage:transformer.safetensors" \
|
| 31 |
+
--learning_rate 1e-5 \
|
| 32 |
+
--num_epochs 5 \
|
| 33 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 34 |
+
--output_path "./models/train/LTX2.3-I2AV-full" \
|
| 35 |
+
--trainable_models "dit" \
|
| 36 |
+
--use_gradient_checkpointing \
|
| 37 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/full/LTX-2.3-T2AV-splited.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2.3-T2AV-splited/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# Splited Training
|
| 4 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2.3-T2AV-splited \
|
| 6 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2.3-T2AV-splited/metadata.csv \
|
| 7 |
+
--data_file_keys "video,input_audio" \
|
| 8 |
+
--extra_inputs "input_audio" \
|
| 9 |
+
--height 512 \
|
| 10 |
+
--width 768 \
|
| 11 |
+
--num_frames 121 \
|
| 12 |
+
--dataset_repeat 1 \
|
| 13 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2.3-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2.3-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2.3-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 14 |
+
--learning_rate 1e-5 \
|
| 15 |
+
--num_epochs 5 \
|
| 16 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 17 |
+
--output_path "./models/train/LTX2.3-T2AV-full-splited-cache" \
|
| 18 |
+
--trainable_models "dit" \
|
| 19 |
+
--use_gradient_checkpointing \
|
| 20 |
+
--task "sft:data_process"
|
| 21 |
+
|
| 22 |
+
accelerate launch --config_file examples/qwen_image/model_training/full/accelerate_config_zero2offload.yaml examples/ltx2/model_training/train.py \
|
| 23 |
+
--dataset_base_path ./models/train/LTX2.3-T2AV-full-splited-cache \
|
| 24 |
+
--data_file_keys "video,input_audio" \
|
| 25 |
+
--extra_inputs "input_audio" \
|
| 26 |
+
--height 512 \
|
| 27 |
+
--width 768 \
|
| 28 |
+
--num_frames 121 \
|
| 29 |
+
--dataset_repeat 100 \
|
| 30 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2.3-Repackage:transformer.safetensors" \
|
| 31 |
+
--learning_rate 1e-5 \
|
| 32 |
+
--num_epochs 5 \
|
| 33 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 34 |
+
--output_path "./models/train/LTX2.3-T2AV-full" \
|
| 35 |
+
--trainable_models "dit" \
|
| 36 |
+
--use_gradient_checkpointing \
|
| 37 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/JoyAI-Echo-T2AV-splited.sh
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2.3-T2AV-splited/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# Splited Training
|
| 4 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2.3-T2AV-splited \
|
| 6 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2.3-T2AV-splited/metadata.csv \
|
| 7 |
+
--data_file_keys "video,input_audio" \
|
| 8 |
+
--extra_inputs "input_audio" \
|
| 9 |
+
--height 512 \
|
| 10 |
+
--width 768 \
|
| 11 |
+
--num_frames 121 \
|
| 12 |
+
--dataset_repeat 1 \
|
| 13 |
+
--model_id_with_origin_paths "jd-opensource/JoyAI-Echo:JoyAI-Echo-release.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 14 |
+
--learning_rate 1e-4 \
|
| 15 |
+
--num_epochs 5 \
|
| 16 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 17 |
+
--output_path "./models/train/JoyAI-Echo-T2AV_lora-splited-cache" \
|
| 18 |
+
--lora_base_model "dit" \
|
| 19 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 20 |
+
--lora_rank 32 \
|
| 21 |
+
--use_gradient_checkpointing \
|
| 22 |
+
--task "sft:data_process"
|
| 23 |
+
|
| 24 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 25 |
+
--dataset_base_path ./models/train/JoyAI-Echo-T2AV_lora-splited-cache \
|
| 26 |
+
--data_file_keys "video,input_audio" \
|
| 27 |
+
--extra_inputs "input_audio" \
|
| 28 |
+
--height 512 \
|
| 29 |
+
--width 768 \
|
| 30 |
+
--num_frames 121 \
|
| 31 |
+
--dataset_repeat 100 \
|
| 32 |
+
--model_id_with_origin_paths "jd-opensource/JoyAI-Echo:JoyAI-Echo-release.safetensors" \
|
| 33 |
+
--learning_rate 1e-4 \
|
| 34 |
+
--num_epochs 5 \
|
| 35 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 36 |
+
--output_path "./models/train/JoyAI-Echo-T2AV_lora" \
|
| 37 |
+
--lora_base_model "dit" \
|
| 38 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 39 |
+
--lora_rank 32 \
|
| 40 |
+
--use_gradient_checkpointing \
|
| 41 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2-T2AV-IC-LoRA-splited.sh
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2-T2AV-IC-LoRA-splited/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# Splited Training
|
| 4 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-IC-LoRA-splited \
|
| 6 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-IC-LoRA-splited/metadata.json \
|
| 7 |
+
--data_file_keys "video,input_audio,in_context_videos" \
|
| 8 |
+
--extra_inputs "input_audio,in_context_videos,in_context_downsample_factor,frame_rate" \
|
| 9 |
+
--height 512 \
|
| 10 |
+
--width 768 \
|
| 11 |
+
--num_frames 81 \
|
| 12 |
+
--dataset_repeat 1 \
|
| 13 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 14 |
+
--learning_rate 1e-4 \
|
| 15 |
+
--num_epochs 5 \
|
| 16 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 17 |
+
--output_path "./models/train/LTX2-T2AV-IC-LoRA-splited-cache" \
|
| 18 |
+
--lora_base_model "dit" \
|
| 19 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 20 |
+
--lora_rank 32 \
|
| 21 |
+
--use_gradient_checkpointing \
|
| 22 |
+
--task "sft:data_process"
|
| 23 |
+
|
| 24 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 25 |
+
--dataset_base_path ./models/train/LTX2-T2AV-IC-LoRA-splited-cache \
|
| 26 |
+
--data_file_keys "video,input_audio,in_context_videos" \
|
| 27 |
+
--extra_inputs "input_audio,in_context_videos,in_context_downsample_factor,frame_rate" \
|
| 28 |
+
--height 512 \
|
| 29 |
+
--width 768 \
|
| 30 |
+
--num_frames 81 \
|
| 31 |
+
--dataset_repeat 100 \
|
| 32 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2-Repackage:transformer.safetensors" \
|
| 33 |
+
--learning_rate 1e-4 \
|
| 34 |
+
--num_epochs 5 \
|
| 35 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 36 |
+
--output_path "./models/train/LTX2-T2AV-IC-LoRA" \
|
| 37 |
+
--lora_base_model "dit" \
|
| 38 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 39 |
+
--lora_rank 32 \
|
| 40 |
+
--use_gradient_checkpointing \
|
| 41 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2-T2AV-noaudio.sh
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2-T2AV-noaudio/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# single stage training
|
| 4 |
+
# accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
# --dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-noaudio \
|
| 6 |
+
# --dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-noaudio/metadata.csv \
|
| 7 |
+
# --height 256 \
|
| 8 |
+
# --width 384 \
|
| 9 |
+
# --num_frames 25\
|
| 10 |
+
# --dataset_repeat 100 \
|
| 11 |
+
# --model_id_with_origin_paths "DiffSynth-Studio/LTX-2-Repackage:transformer.safetensors,DiffSynth-Studio/LTX-2-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 12 |
+
# --learning_rate 1e-4 \
|
| 13 |
+
# --num_epochs 5 \
|
| 14 |
+
# --remove_prefix_in_ckpt "pipe.dit." \
|
| 15 |
+
# --output_path "./models/train/LTX2-T2AV-noaudio_lora" \
|
| 16 |
+
# --lora_base_model "dit" \
|
| 17 |
+
# --lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 18 |
+
# --lora_rank 32 \
|
| 19 |
+
# --use_gradient_checkpointing \
|
| 20 |
+
# --find_unused_parameters
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# Splited Training
|
| 24 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 25 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-noaudio \
|
| 26 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-noaudio/metadata.csv \
|
| 27 |
+
--height 512 \
|
| 28 |
+
--width 768 \
|
| 29 |
+
--num_frames 121\
|
| 30 |
+
--dataset_repeat 1 \
|
| 31 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 32 |
+
--learning_rate 1e-4 \
|
| 33 |
+
--num_epochs 5 \
|
| 34 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 35 |
+
--output_path "./models/train/LTX2-T2AV-noaudio_lora-splited-cache" \
|
| 36 |
+
--lora_base_model "dit" \
|
| 37 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 38 |
+
--lora_rank 32 \
|
| 39 |
+
--use_gradient_checkpointing \
|
| 40 |
+
--task "sft:data_process"
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 44 |
+
--dataset_base_path ./models/train/LTX2-T2AV-noaudio_lora-splited-cache \
|
| 45 |
+
--height 512 \
|
| 46 |
+
--width 768 \
|
| 47 |
+
--num_frames 121\
|
| 48 |
+
--dataset_repeat 100 \
|
| 49 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2-Repackage:transformer.safetensors" \
|
| 50 |
+
--learning_rate 1e-4 \
|
| 51 |
+
--num_epochs 5 \
|
| 52 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 53 |
+
--output_path "./models/train/LTX2-T2AV-noaudio_lora" \
|
| 54 |
+
--lora_base_model "dit" \
|
| 55 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 56 |
+
--lora_rank 32 \
|
| 57 |
+
--use_gradient_checkpointing \
|
| 58 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2-T2AV-splited.sh
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2-T2AV-splited/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# Single Stage Training not recommended for T2AV due to the large memory consumption. Please use the Splited Training instead.
|
| 4 |
+
# accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
# --dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-splited \
|
| 6 |
+
# --dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-splited/metadata.csv \
|
| 7 |
+
# --data_file_keys "video,input_audio" \
|
| 8 |
+
# --extra_inputs "input_audio" \
|
| 9 |
+
# --height 256 \
|
| 10 |
+
# --width 384 \
|
| 11 |
+
# --num_frames 25\
|
| 12 |
+
# --dataset_repeat 100 \
|
| 13 |
+
# --model_id_with_origin_paths "DiffSynth-Studio/LTX-2-Repackage:transformer.safetensors,DiffSynth-Studio/LTX-2-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 14 |
+
# --learning_rate 1e-4 \
|
| 15 |
+
# --num_epochs 5 \
|
| 16 |
+
# --remove_prefix_in_ckpt "pipe.dit." \
|
| 17 |
+
# --output_path "./models/train/LTX2-T2AV_lora" \
|
| 18 |
+
# --lora_base_model "dit" \
|
| 19 |
+
# --lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 20 |
+
# --lora_rank 32 \
|
| 21 |
+
# --use_gradient_checkpointing \
|
| 22 |
+
# --find_unused_parameters
|
| 23 |
+
|
| 24 |
+
# Splited Training
|
| 25 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 26 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-splited \
|
| 27 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2-T2AV-splited/metadata.csv \
|
| 28 |
+
--data_file_keys "video,input_audio" \
|
| 29 |
+
--extra_inputs "input_audio" \
|
| 30 |
+
--height 512 \
|
| 31 |
+
--width 768 \
|
| 32 |
+
--num_frames 121 \
|
| 33 |
+
--dataset_repeat 1 \
|
| 34 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 35 |
+
--learning_rate 1e-4 \
|
| 36 |
+
--num_epochs 5 \
|
| 37 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 38 |
+
--output_path "./models/train/LTX2-T2AV_lora-splited-cache" \
|
| 39 |
+
--lora_base_model "dit" \
|
| 40 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 41 |
+
--lora_rank 32 \
|
| 42 |
+
--use_gradient_checkpointing \
|
| 43 |
+
--task "sft:data_process"
|
| 44 |
+
|
| 45 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 46 |
+
--dataset_base_path ./models/train/LTX2-T2AV_lora-splited-cache \
|
| 47 |
+
--data_file_keys "video,input_audio" \
|
| 48 |
+
--extra_inputs "input_audio" \
|
| 49 |
+
--height 512 \
|
| 50 |
+
--width 768 \
|
| 51 |
+
--num_frames 121 \
|
| 52 |
+
--dataset_repeat 100 \
|
| 53 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2-Repackage:transformer.safetensors" \
|
| 54 |
+
--learning_rate 1e-4 \
|
| 55 |
+
--num_epochs 5 \
|
| 56 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 57 |
+
--output_path "./models/train/LTX2-T2AV_lora" \
|
| 58 |
+
--lora_base_model "dit" \
|
| 59 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 60 |
+
--lora_rank 32 \
|
| 61 |
+
--use_gradient_checkpointing \
|
| 62 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2.3-I2AV-splited.sh
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2.3-I2AV-splited/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# Splited Training
|
| 4 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2.3-I2AV-splited \
|
| 6 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2.3-I2AV-splited/metadata.csv \
|
| 7 |
+
--data_file_keys "video,input_audio" \
|
| 8 |
+
--extra_inputs "input_audio,input_image" \
|
| 9 |
+
--height 512 \
|
| 10 |
+
--width 768 \
|
| 11 |
+
--num_frames 121 \
|
| 12 |
+
--dataset_repeat 1 \
|
| 13 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2.3-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2.3-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2.3-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 14 |
+
--learning_rate 1e-4 \
|
| 15 |
+
--num_epochs 5 \
|
| 16 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 17 |
+
--output_path "./models/train/LTX2.3-I2AV_lora-splited-cache" \
|
| 18 |
+
--lora_base_model "dit" \
|
| 19 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 20 |
+
--lora_rank 32 \
|
| 21 |
+
--use_gradient_checkpointing \
|
| 22 |
+
--task "sft:data_process"
|
| 23 |
+
|
| 24 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 25 |
+
--dataset_base_path ./models/train/LTX2.3-I2AV_lora-splited-cache \
|
| 26 |
+
--data_file_keys "video,input_audio" \
|
| 27 |
+
--extra_inputs "input_audio,input_image" \
|
| 28 |
+
--height 512 \
|
| 29 |
+
--width 768 \
|
| 30 |
+
--num_frames 121 \
|
| 31 |
+
--dataset_repeat 100 \
|
| 32 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2.3-Repackage:transformer.safetensors" \
|
| 33 |
+
--learning_rate 1e-4 \
|
| 34 |
+
--num_epochs 5 \
|
| 35 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 36 |
+
--output_path "./models/train/LTX2.3-I2AV_lora" \
|
| 37 |
+
--lora_base_model "dit" \
|
| 38 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 39 |
+
--lora_rank 32 \
|
| 40 |
+
--use_gradient_checkpointing \
|
| 41 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2.3-T2AV-IC-LoRA-splited.sh
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2.3-T2AV-IC-LoRA-splited/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# Splited Training
|
| 4 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2.3-T2AV-IC-LoRA-splited \
|
| 6 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2.3-T2AV-IC-LoRA-splited/metadata.json \
|
| 7 |
+
--data_file_keys "video,input_audio,in_context_videos" \
|
| 8 |
+
--extra_inputs "input_audio,in_context_videos,in_context_downsample_factor,frame_rate" \
|
| 9 |
+
--height 512 \
|
| 10 |
+
--width 768 \
|
| 11 |
+
--num_frames 81 \
|
| 12 |
+
--dataset_repeat 1 \
|
| 13 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2.3-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2.3-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2.3-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 14 |
+
--learning_rate 1e-4 \
|
| 15 |
+
--num_epochs 5 \
|
| 16 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 17 |
+
--output_path "./models/train/LTX2.3-T2AV-IC-LoRA-splited-cache" \
|
| 18 |
+
--lora_base_model "dit" \
|
| 19 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 20 |
+
--lora_rank 32 \
|
| 21 |
+
--use_gradient_checkpointing \
|
| 22 |
+
--task "sft:data_process"
|
| 23 |
+
|
| 24 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 25 |
+
--dataset_base_path ./models/train/LTX2.3-T2AV-IC-LoRA-splited-cache \
|
| 26 |
+
--data_file_keys "video,input_audio,in_context_videos" \
|
| 27 |
+
--extra_inputs "input_audio,in_context_videos,in_context_downsample_factor,frame_rate" \
|
| 28 |
+
--height 512 \
|
| 29 |
+
--width 768 \
|
| 30 |
+
--num_frames 81 \
|
| 31 |
+
--dataset_repeat 100 \
|
| 32 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2.3-Repackage:transformer.safetensors" \
|
| 33 |
+
--learning_rate 1e-4 \
|
| 34 |
+
--num_epochs 5 \
|
| 35 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 36 |
+
--output_path "./models/train/LTX2.3-T2AV-IC-LoRA" \
|
| 37 |
+
--lora_base_model "dit" \
|
| 38 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 39 |
+
--lora_rank 32 \
|
| 40 |
+
--use_gradient_checkpointing \
|
| 41 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/lora/LTX-2.3-T2AV-splited.sh
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "ltx2/LTX-2.3-T2AV-splited/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
# Splited Training
|
| 4 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 5 |
+
--dataset_base_path data/diffsynth_example_dataset/ltx2/LTX-2.3-T2AV-splited \
|
| 6 |
+
--dataset_metadata_path data/diffsynth_example_dataset/ltx2/LTX-2.3-T2AV-splited/metadata.csv \
|
| 7 |
+
--data_file_keys "video,input_audio" \
|
| 8 |
+
--extra_inputs "input_audio" \
|
| 9 |
+
--height 512 \
|
| 10 |
+
--width 768 \
|
| 11 |
+
--num_frames 121 \
|
| 12 |
+
--dataset_repeat 1 \
|
| 13 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2.3-Repackage:text_encoder_post_modules.safetensors,DiffSynth-Studio/LTX-2.3-Repackage:video_vae_encoder.safetensors,DiffSynth-Studio/LTX-2.3-Repackage:audio_vae_encoder.safetensors,google/gemma-3-12b-it-qat-q4_0-unquantized:model-*.safetensors" \
|
| 14 |
+
--learning_rate 1e-4 \
|
| 15 |
+
--num_epochs 5 \
|
| 16 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 17 |
+
--output_path "./models/train/LTX2.3-T2AV_lora-splited-cache" \
|
| 18 |
+
--lora_base_model "dit" \
|
| 19 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 20 |
+
--lora_rank 32 \
|
| 21 |
+
--use_gradient_checkpointing \
|
| 22 |
+
--task "sft:data_process"
|
| 23 |
+
|
| 24 |
+
accelerate launch examples/ltx2/model_training/train.py \
|
| 25 |
+
--dataset_base_path ./models/train/LTX2.3-T2AV_lora-splited-cache \
|
| 26 |
+
--data_file_keys "video,input_audio" \
|
| 27 |
+
--extra_inputs "input_audio" \
|
| 28 |
+
--height 512 \
|
| 29 |
+
--width 768 \
|
| 30 |
+
--num_frames 121 \
|
| 31 |
+
--dataset_repeat 100 \
|
| 32 |
+
--model_id_with_origin_paths "DiffSynth-Studio/LTX-2.3-Repackage:transformer.safetensors" \
|
| 33 |
+
--learning_rate 1e-4 \
|
| 34 |
+
--num_epochs 5 \
|
| 35 |
+
--remove_prefix_in_ckpt "pipe.dit." \
|
| 36 |
+
--output_path "./models/train/LTX2.3-T2AV_lora" \
|
| 37 |
+
--lora_base_model "dit" \
|
| 38 |
+
--lora_target_modules "to_k,to_q,to_v,to_out.0" \
|
| 39 |
+
--lora_rank 32 \
|
| 40 |
+
--use_gradient_checkpointing \
|
| 41 |
+
--task "sft:train"
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/scripts/split_model_statedicts.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from safetensors.torch import save_file
|
| 2 |
+
from diffsynth import hash_state_dict_keys
|
| 3 |
+
from diffsynth.core import load_state_dict
|
| 4 |
+
from diffsynth.models.model_loader import ModelPool
|
| 5 |
+
|
| 6 |
+
model_pool = ModelPool()
|
| 7 |
+
state_dict = load_state_dict("models/Lightricks/LTX-2/ltx-2-19b-dev.safetensors")
|
| 8 |
+
|
| 9 |
+
dit_state_dict = {}
|
| 10 |
+
for name in state_dict:
|
| 11 |
+
if name.startswith("model.diffusion_model."):
|
| 12 |
+
new_name = name.replace("model.diffusion_model.", "")
|
| 13 |
+
if new_name.startswith("audio_embeddings_connector.") or new_name.startswith("video_embeddings_connector."):
|
| 14 |
+
continue
|
| 15 |
+
dit_state_dict[name] = state_dict[name]
|
| 16 |
+
|
| 17 |
+
print(f"dit_state_dict keys hash: {hash_state_dict_keys(dit_state_dict)}")
|
| 18 |
+
save_file(dit_state_dict, "models/DiffSynth-Studio/LTX-2-Repackage/transformer.safetensors")
|
| 19 |
+
model_pool.auto_load_model(
|
| 20 |
+
"models/DiffSynth-Studio/LTX-2-Repackage/transformer.safetensors",
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
video_vae_encoder_state_dict = {}
|
| 25 |
+
for name in state_dict:
|
| 26 |
+
if name.startswith("vae.encoder."):
|
| 27 |
+
video_vae_encoder_state_dict[name] = state_dict[name]
|
| 28 |
+
elif name.startswith("vae.per_channel_statistics."):
|
| 29 |
+
video_vae_encoder_state_dict[name] = state_dict[name]
|
| 30 |
+
|
| 31 |
+
save_file(video_vae_encoder_state_dict, "models/DiffSynth-Studio/LTX-2-Repackage/video_vae_encoder.safetensors")
|
| 32 |
+
print(f"video_vae_encoder keys hash: {hash_state_dict_keys(video_vae_encoder_state_dict)}")
|
| 33 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2-Repackage/video_vae_encoder.safetensors")
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
video_vae_decoder_state_dict = {}
|
| 37 |
+
for name in state_dict:
|
| 38 |
+
if name.startswith("vae.decoder."):
|
| 39 |
+
video_vae_decoder_state_dict[name] = state_dict[name]
|
| 40 |
+
elif name.startswith("vae.per_channel_statistics."):
|
| 41 |
+
video_vae_decoder_state_dict[name] = state_dict[name]
|
| 42 |
+
save_file(video_vae_decoder_state_dict, "models/DiffSynth-Studio/LTX-2-Repackage/video_vae_decoder.safetensors")
|
| 43 |
+
print(f"video_vae_decoder keys hash: {hash_state_dict_keys(video_vae_decoder_state_dict)}")
|
| 44 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2-Repackage/video_vae_decoder.safetensors")
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
audio_vae_decoder_state_dict = {}
|
| 48 |
+
for name in state_dict:
|
| 49 |
+
if name.startswith("audio_vae.decoder."):
|
| 50 |
+
audio_vae_decoder_state_dict[name] = state_dict[name]
|
| 51 |
+
elif name.startswith("audio_vae.per_channel_statistics."):
|
| 52 |
+
audio_vae_decoder_state_dict[name] = state_dict[name]
|
| 53 |
+
save_file(audio_vae_decoder_state_dict, "models/DiffSynth-Studio/LTX-2-Repackage/audio_vae_decoder.safetensors")
|
| 54 |
+
print(f"audio_vae_decoder keys hash: {hash_state_dict_keys(audio_vae_decoder_state_dict)}")
|
| 55 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2-Repackage/audio_vae_decoder.safetensors")
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
audio_vae_encoder_state_dict = {}
|
| 59 |
+
for name in state_dict:
|
| 60 |
+
if name.startswith("audio_vae.encoder."):
|
| 61 |
+
audio_vae_encoder_state_dict[name] = state_dict[name]
|
| 62 |
+
elif name.startswith("audio_vae.per_channel_statistics."):
|
| 63 |
+
audio_vae_encoder_state_dict[name] = state_dict[name]
|
| 64 |
+
save_file(audio_vae_encoder_state_dict, "models/DiffSynth-Studio/LTX-2-Repackage/audio_vae_encoder.safetensors")
|
| 65 |
+
print(f"audio_vae_encoder keys hash: {hash_state_dict_keys(audio_vae_encoder_state_dict)}")
|
| 66 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2-Repackage/audio_vae_encoder.safetensors")
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
audio_vocoder_state_dict = {}
|
| 70 |
+
for name in state_dict:
|
| 71 |
+
if name.startswith("vocoder."):
|
| 72 |
+
audio_vocoder_state_dict[name] = state_dict[name]
|
| 73 |
+
save_file(audio_vocoder_state_dict, "models/DiffSynth-Studio/LTX-2-Repackage/audio_vocoder.safetensors")
|
| 74 |
+
print(f"audio_vocoder keys hash: {hash_state_dict_keys(audio_vocoder_state_dict)}")
|
| 75 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2-Repackage/audio_vocoder.safetensors")
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
text_encoder_post_modules_state_dict = {}
|
| 79 |
+
for name in state_dict:
|
| 80 |
+
if name.startswith("text_embedding_projection."):
|
| 81 |
+
text_encoder_post_modules_state_dict[name] = state_dict[name]
|
| 82 |
+
elif name.startswith("model.diffusion_model.video_embeddings_connector."):
|
| 83 |
+
text_encoder_post_modules_state_dict[name] = state_dict[name]
|
| 84 |
+
elif name.startswith("model.diffusion_model.audio_embeddings_connector."):
|
| 85 |
+
text_encoder_post_modules_state_dict[name] = state_dict[name]
|
| 86 |
+
save_file(text_encoder_post_modules_state_dict, "models/DiffSynth-Studio/LTX-2-Repackage/text_encoder_post_modules.safetensors")
|
| 87 |
+
print(f"text_encoder_post_modules keys hash: {hash_state_dict_keys(text_encoder_post_modules_state_dict)}")
|
| 88 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2-Repackage/text_encoder_post_modules.safetensors")
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
state_dict = load_state_dict("models/Lightricks/LTX-2/ltx-2-19b-distilled.safetensors")
|
| 92 |
+
dit_state_dict = {}
|
| 93 |
+
for name in state_dict:
|
| 94 |
+
if name.startswith("model.diffusion_model."):
|
| 95 |
+
new_name = name.replace("model.diffusion_model.", "")
|
| 96 |
+
if new_name.startswith("audio_embeddings_connector.") or new_name.startswith("video_embeddings_connector."):
|
| 97 |
+
continue
|
| 98 |
+
dit_state_dict[name] = state_dict[name]
|
| 99 |
+
|
| 100 |
+
print(f"dit_state_dict keys hash: {hash_state_dict_keys(dit_state_dict)}")
|
| 101 |
+
save_file(dit_state_dict, "models/DiffSynth-Studio/LTX-2-Repackage/transformer_distilled.safetensors")
|
| 102 |
+
model_pool.auto_load_model(
|
| 103 |
+
"models/DiffSynth-Studio/LTX-2-Repackage/transformer_distilled.safetensors",
|
| 104 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/scripts/split_model_statedicts_ltx2.3.py
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from safetensors.torch import save_file
|
| 2 |
+
from diffsynth import hash_state_dict_keys
|
| 3 |
+
from diffsynth.core import load_state_dict
|
| 4 |
+
from diffsynth.models.model_loader import ModelPool
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
model_pool = ModelPool()
|
| 8 |
+
state_dict = load_state_dict("models/Lightricks/LTX-2.3/ltx-2.3-22b-dev.safetensors")
|
| 9 |
+
os.makedirs("models/DiffSynth-Studio/LTX-2.3-Repackage", exist_ok=True)
|
| 10 |
+
|
| 11 |
+
dit_state_dict = {}
|
| 12 |
+
for name in state_dict:
|
| 13 |
+
if name.startswith("model.diffusion_model."):
|
| 14 |
+
new_name = name.replace("model.diffusion_model.", "")
|
| 15 |
+
if new_name.startswith("audio_embeddings_connector.") or new_name.startswith("video_embeddings_connector."):
|
| 16 |
+
continue
|
| 17 |
+
dit_state_dict[name] = state_dict[name]
|
| 18 |
+
|
| 19 |
+
print(f"dit_state_dict keys hash: {hash_state_dict_keys(dit_state_dict)}")
|
| 20 |
+
save_file(dit_state_dict, "models/DiffSynth-Studio/LTX-2.3-Repackage/transformer.safetensors")
|
| 21 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2.3-Repackage/transformer.safetensors")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
video_vae_encoder_state_dict = {}
|
| 25 |
+
for name in state_dict:
|
| 26 |
+
if name.startswith("vae.encoder."):
|
| 27 |
+
video_vae_encoder_state_dict[name] = state_dict[name]
|
| 28 |
+
elif name.startswith("vae.per_channel_statistics."):
|
| 29 |
+
video_vae_encoder_state_dict[name] = state_dict[name]
|
| 30 |
+
|
| 31 |
+
save_file(video_vae_encoder_state_dict, "models/DiffSynth-Studio/LTX-2.3-Repackage/video_vae_encoder.safetensors")
|
| 32 |
+
print(f"video_vae_encoder keys hash: {hash_state_dict_keys(video_vae_encoder_state_dict)}")
|
| 33 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2.3-Repackage/video_vae_encoder.safetensors")
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
video_vae_decoder_state_dict = {}
|
| 37 |
+
for name in state_dict:
|
| 38 |
+
if name.startswith("vae.decoder."):
|
| 39 |
+
video_vae_decoder_state_dict[name] = state_dict[name]
|
| 40 |
+
elif name.startswith("vae.per_channel_statistics."):
|
| 41 |
+
video_vae_decoder_state_dict[name] = state_dict[name]
|
| 42 |
+
save_file(video_vae_decoder_state_dict, "models/DiffSynth-Studio/LTX-2.3-Repackage/video_vae_decoder.safetensors")
|
| 43 |
+
print(f"video_vae_decoder keys hash: {hash_state_dict_keys(video_vae_decoder_state_dict)}")
|
| 44 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2.3-Repackage/video_vae_decoder.safetensors")
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
audio_vae_decoder_state_dict = {}
|
| 48 |
+
for name in state_dict:
|
| 49 |
+
if name.startswith("audio_vae.decoder."):
|
| 50 |
+
audio_vae_decoder_state_dict[name] = state_dict[name]
|
| 51 |
+
elif name.startswith("audio_vae.per_channel_statistics."):
|
| 52 |
+
audio_vae_decoder_state_dict[name] = state_dict[name]
|
| 53 |
+
save_file(audio_vae_decoder_state_dict, "models/DiffSynth-Studio/LTX-2.3-Repackage/audio_vae_decoder.safetensors")
|
| 54 |
+
print(f"audio_vae_decoder keys hash: {hash_state_dict_keys(audio_vae_decoder_state_dict)}")
|
| 55 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2.3-Repackage/audio_vae_decoder.safetensors")
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
audio_vae_encoder_state_dict = {}
|
| 59 |
+
for name in state_dict:
|
| 60 |
+
if name.startswith("audio_vae.encoder."):
|
| 61 |
+
audio_vae_encoder_state_dict[name] = state_dict[name]
|
| 62 |
+
elif name.startswith("audio_vae.per_channel_statistics."):
|
| 63 |
+
audio_vae_encoder_state_dict[name] = state_dict[name]
|
| 64 |
+
save_file(audio_vae_encoder_state_dict, "models/DiffSynth-Studio/LTX-2.3-Repackage/audio_vae_encoder.safetensors")
|
| 65 |
+
print(f"audio_vae_encoder keys hash: {hash_state_dict_keys(audio_vae_encoder_state_dict)}")
|
| 66 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2.3-Repackage/audio_vae_encoder.safetensors")
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
audio_vocoder_state_dict = {}
|
| 70 |
+
for name in state_dict:
|
| 71 |
+
if name.startswith("vocoder."):
|
| 72 |
+
audio_vocoder_state_dict[name] = state_dict[name]
|
| 73 |
+
save_file(audio_vocoder_state_dict, "models/DiffSynth-Studio/LTX-2.3-Repackage/audio_vocoder.safetensors")
|
| 74 |
+
print(f"audio_vocoder keys hash: {hash_state_dict_keys(audio_vocoder_state_dict)}")
|
| 75 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2.3-Repackage/audio_vocoder.safetensors")
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
text_encoder_post_modules_state_dict = {}
|
| 79 |
+
for name in state_dict:
|
| 80 |
+
if name.startswith("text_embedding_projection."):
|
| 81 |
+
text_encoder_post_modules_state_dict[name] = state_dict[name]
|
| 82 |
+
elif name.startswith("model.diffusion_model.video_embeddings_connector."):
|
| 83 |
+
text_encoder_post_modules_state_dict[name] = state_dict[name]
|
| 84 |
+
elif name.startswith("model.diffusion_model.audio_embeddings_connector."):
|
| 85 |
+
text_encoder_post_modules_state_dict[name] = state_dict[name]
|
| 86 |
+
save_file(text_encoder_post_modules_state_dict, "models/DiffSynth-Studio/LTX-2.3-Repackage/text_encoder_post_modules.safetensors")
|
| 87 |
+
print(f"text_encoder_post_modules keys hash: {hash_state_dict_keys(text_encoder_post_modules_state_dict)}")
|
| 88 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2.3-Repackage/text_encoder_post_modules.safetensors")
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
state_dict = load_state_dict("models/Lightricks/LTX-2.3/ltx-2.3-22b-distilled.safetensors")
|
| 92 |
+
dit_state_dict = {}
|
| 93 |
+
for name in state_dict:
|
| 94 |
+
if name.startswith("model.diffusion_model."):
|
| 95 |
+
new_name = name.replace("model.diffusion_model.", "")
|
| 96 |
+
if new_name.startswith("audio_embeddings_connector.") or new_name.startswith("video_embeddings_connector."):
|
| 97 |
+
continue
|
| 98 |
+
dit_state_dict[name] = state_dict[name]
|
| 99 |
+
|
| 100 |
+
print(f"dit_state_dict keys hash: {hash_state_dict_keys(dit_state_dict)}")
|
| 101 |
+
save_file(dit_state_dict, "models/DiffSynth-Studio/LTX-2.3-Repackage/transformer_distilled.safetensors")
|
| 102 |
+
model_pool.auto_load_model("models/DiffSynth-Studio/LTX-2.3-Repackage/transformer_distilled.safetensors")
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/train.py
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch, os, argparse, accelerate, warnings
|
| 2 |
+
from diffsynth.core import UnifiedDataset
|
| 3 |
+
from diffsynth.core.data.operators import LoadAudioWithTorchaudio, ToAbsolutePath, RouteByType, SequencialProcess
|
| 4 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 5 |
+
from diffsynth.diffusion import *
|
| 6 |
+
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class LTX2TrainingModule(DiffusionTrainingModule):
|
| 10 |
+
def __init__(
|
| 11 |
+
self,
|
| 12 |
+
model_paths=None, model_id_with_origin_paths=None,
|
| 13 |
+
tokenizer_path=None,
|
| 14 |
+
trainable_models=None,
|
| 15 |
+
lora_base_model=None, lora_target_modules="", lora_rank=32, lora_checkpoint=None,
|
| 16 |
+
preset_lora_path=None, preset_lora_model=None,
|
| 17 |
+
use_gradient_checkpointing=True,
|
| 18 |
+
use_gradient_checkpointing_offload=False,
|
| 19 |
+
extra_inputs=None,
|
| 20 |
+
fp8_models=None,
|
| 21 |
+
offload_models=None,
|
| 22 |
+
resume_from_checkpoint=None, remove_prefix_in_ckpt=None,
|
| 23 |
+
device="cpu",
|
| 24 |
+
task="sft",
|
| 25 |
+
):
|
| 26 |
+
super().__init__()
|
| 27 |
+
# Warning
|
| 28 |
+
if not use_gradient_checkpointing:
|
| 29 |
+
warnings.warn("Gradient checkpointing is detected as disabled. To prevent out-of-memory errors, the training framework will forcibly enable gradient checkpointing.")
|
| 30 |
+
use_gradient_checkpointing = True
|
| 31 |
+
|
| 32 |
+
# Load models
|
| 33 |
+
model_configs = self.parse_model_configs(model_paths, model_id_with_origin_paths, fp8_models=fp8_models, offload_models=offload_models, device=device)
|
| 34 |
+
tokenizer_config = ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized") if tokenizer_path is None else ModelConfig(tokenizer_path)
|
| 35 |
+
self.pipe = LTX2AudioVideoPipeline.from_pretrained(torch_dtype=torch.bfloat16, device=device, model_configs=model_configs, tokenizer_config=tokenizer_config)
|
| 36 |
+
self.pipe = self.split_pipeline_units(
|
| 37 |
+
task, self.pipe, trainable_models, lora_base_model,
|
| 38 |
+
remove_unnecessary_params=True,
|
| 39 |
+
force_remove_params_shared=("audio_latents", "video_latents"),
|
| 40 |
+
force_remove_params_nega=("audio_context", "video_context")
|
| 41 |
+
)
|
| 42 |
+
self.resume_from_checkpoint(resume_from_checkpoint, remove_prefix_in_ckpt)
|
| 43 |
+
# Training mode
|
| 44 |
+
self.switch_pipe_to_training_mode(
|
| 45 |
+
self.pipe, trainable_models,
|
| 46 |
+
lora_base_model, lora_target_modules, lora_rank, lora_checkpoint,
|
| 47 |
+
preset_lora_path, preset_lora_model,
|
| 48 |
+
task=task,
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
# Store other configs
|
| 52 |
+
self.use_gradient_checkpointing = use_gradient_checkpointing
|
| 53 |
+
self.use_gradient_checkpointing_offload = use_gradient_checkpointing_offload
|
| 54 |
+
self.extra_inputs = extra_inputs.split(",") if extra_inputs is not None else []
|
| 55 |
+
self.fp8_models = fp8_models
|
| 56 |
+
self.task = task
|
| 57 |
+
self.task_to_loss = {
|
| 58 |
+
"sft:data_process": lambda pipe, *args: args,
|
| 59 |
+
"sft": lambda pipe, inputs_shared, inputs_posi, inputs_nega: FlowMatchSFTAudioVideoLoss(pipe, **inputs_shared, **inputs_posi),
|
| 60 |
+
"sft:train": lambda pipe, inputs_shared, inputs_posi, inputs_nega: FlowMatchSFTAudioVideoLoss(pipe, **inputs_shared, **inputs_posi),
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
def parse_extra_inputs(self, data, extra_inputs, inputs_shared):
|
| 64 |
+
for extra_input in extra_inputs:
|
| 65 |
+
if extra_input == "input_image":
|
| 66 |
+
inputs_shared["input_images"] = [data["video"][0]]
|
| 67 |
+
inputs_shared["input_images_indexes"] = [0]
|
| 68 |
+
inputs_shared["input_images_strength"] = 1.0
|
| 69 |
+
else:
|
| 70 |
+
inputs_shared[extra_input] = data[extra_input]
|
| 71 |
+
return inputs_shared
|
| 72 |
+
|
| 73 |
+
def get_pipeline_inputs(self, data):
|
| 74 |
+
inputs_posi = {"prompt": data["prompt"]}
|
| 75 |
+
inputs_nega = {}
|
| 76 |
+
inputs_shared = {
|
| 77 |
+
# Assume you are using this pipeline for inference,
|
| 78 |
+
# please fill in the input parameters.
|
| 79 |
+
"input_video": data["video"],
|
| 80 |
+
"height": data["video"][0].size[1],
|
| 81 |
+
"width": data["video"][0].size[0],
|
| 82 |
+
"num_frames": len(data["video"]),
|
| 83 |
+
"frame_rate": data.get("frame_rate", 24),
|
| 84 |
+
# Please do not modify the following parameters
|
| 85 |
+
# unless you clearly know what this will cause.
|
| 86 |
+
"cfg_scale": 1,
|
| 87 |
+
"tiled": False,
|
| 88 |
+
"rand_device": self.pipe.device,
|
| 89 |
+
"use_gradient_checkpointing": self.use_gradient_checkpointing,
|
| 90 |
+
"use_gradient_checkpointing_offload": self.use_gradient_checkpointing_offload,
|
| 91 |
+
"video_patchifier": self.pipe.video_patchifier,
|
| 92 |
+
"audio_patchifier": self.pipe.audio_patchifier,
|
| 93 |
+
}
|
| 94 |
+
inputs_shared = self.parse_extra_inputs(data, self.extra_inputs, inputs_shared)
|
| 95 |
+
return inputs_shared, inputs_posi, inputs_nega
|
| 96 |
+
|
| 97 |
+
def forward(self, data, inputs=None):
|
| 98 |
+
if inputs is None: inputs = self.get_pipeline_inputs(data)
|
| 99 |
+
inputs = self.transfer_data_to_device(inputs, self.pipe.device, self.pipe.torch_dtype)
|
| 100 |
+
for unit in self.pipe.units:
|
| 101 |
+
inputs = self.pipe.unit_runner(unit, self.pipe, *inputs)
|
| 102 |
+
loss = self.task_to_loss[self.task](self.pipe, *inputs)
|
| 103 |
+
return loss
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def ltx2_parser():
|
| 107 |
+
parser = argparse.ArgumentParser(description="Simple example of a training script.")
|
| 108 |
+
parser = add_general_config(parser)
|
| 109 |
+
parser = add_video_size_config(parser)
|
| 110 |
+
parser.add_argument("--tokenizer_path", type=str, default=None, help="Path to tokenizer.")
|
| 111 |
+
parser.add_argument("--frame_rate", type=float, default=24, help="frame rate of the training videos.")
|
| 112 |
+
parser.add_argument("--initialize_model_on_cpu", default=False, action="store_true", help="Whether to initialize models on CPU.")
|
| 113 |
+
return parser
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
if __name__ == "__main__":
|
| 117 |
+
parser = ltx2_parser()
|
| 118 |
+
args = parser.parse_args()
|
| 119 |
+
accelerator = accelerate.Accelerator(
|
| 120 |
+
gradient_accumulation_steps=args.gradient_accumulation_steps,
|
| 121 |
+
kwargs_handlers=[accelerate.DistributedDataParallelKwargs(find_unused_parameters=args.find_unused_parameters)],
|
| 122 |
+
)
|
| 123 |
+
video_processor = UnifiedDataset.default_video_operator(
|
| 124 |
+
base_path=args.dataset_base_path,
|
| 125 |
+
max_pixels=args.max_pixels,
|
| 126 |
+
height=args.height,
|
| 127 |
+
width=args.width,
|
| 128 |
+
height_division_factor=32,
|
| 129 |
+
width_division_factor=32,
|
| 130 |
+
num_frames=args.num_frames,
|
| 131 |
+
time_division_factor=8,
|
| 132 |
+
time_division_remainder=1,
|
| 133 |
+
frame_rate=args.frame_rate,
|
| 134 |
+
fix_frame_rate=True,
|
| 135 |
+
)
|
| 136 |
+
dataset = UnifiedDataset(
|
| 137 |
+
base_path=args.dataset_base_path,
|
| 138 |
+
metadata_path=args.dataset_metadata_path,
|
| 139 |
+
repeat=args.dataset_repeat,
|
| 140 |
+
data_file_keys=args.data_file_keys.split(","),
|
| 141 |
+
main_data_operator=video_processor,
|
| 142 |
+
special_operator_map={
|
| 143 |
+
"input_audio": ToAbsolutePath(args.dataset_base_path) >> LoadAudioWithTorchaudio(num_frames=args.num_frames, time_division_factor=8, time_division_remainder=1, frame_rate=args.frame_rate),
|
| 144 |
+
"in_context_videos": RouteByType(operator_map=[
|
| 145 |
+
(str, video_processor),
|
| 146 |
+
(list, SequencialProcess(video_processor)),
|
| 147 |
+
]),
|
| 148 |
+
}
|
| 149 |
+
)
|
| 150 |
+
model = LTX2TrainingModule(
|
| 151 |
+
model_paths=args.model_paths,
|
| 152 |
+
model_id_with_origin_paths=args.model_id_with_origin_paths,
|
| 153 |
+
tokenizer_path=args.tokenizer_path,
|
| 154 |
+
trainable_models=args.trainable_models,
|
| 155 |
+
lora_base_model=args.lora_base_model,
|
| 156 |
+
lora_target_modules=args.lora_target_modules,
|
| 157 |
+
lora_rank=args.lora_rank,
|
| 158 |
+
lora_checkpoint=args.lora_checkpoint,
|
| 159 |
+
preset_lora_path=args.preset_lora_path,
|
| 160 |
+
preset_lora_model=args.preset_lora_model,
|
| 161 |
+
use_gradient_checkpointing=args.use_gradient_checkpointing,
|
| 162 |
+
use_gradient_checkpointing_offload=args.use_gradient_checkpointing_offload,
|
| 163 |
+
extra_inputs=args.extra_inputs,
|
| 164 |
+
fp8_models=args.fp8_models,
|
| 165 |
+
offload_models=args.offload_models,
|
| 166 |
+
resume_from_checkpoint=args.resume_from_checkpoint,
|
| 167 |
+
remove_prefix_in_ckpt=args.remove_prefix_in_ckpt,
|
| 168 |
+
task=args.task,
|
| 169 |
+
device="cpu" if (args.initialize_model_on_cpu or args.enable_model_cpu_offload) else accelerator.device,
|
| 170 |
+
)
|
| 171 |
+
model_logger = ModelLogger(
|
| 172 |
+
args.output_path,
|
| 173 |
+
remove_prefix_in_ckpt=args.remove_prefix_in_ckpt,
|
| 174 |
+
enable_tensorboard_log=args.enable_tensorboard_log,
|
| 175 |
+
enable_swanlab_log=args.enable_swanlab_log,
|
| 176 |
+
swanlab_project=args.swanlab_project,
|
| 177 |
+
enable_wandb_log=args.enable_wandb_log,
|
| 178 |
+
wandb_project=args.wandb_project,
|
| 179 |
+
)
|
| 180 |
+
launcher_map = {
|
| 181 |
+
"sft:data_process": launch_data_process_task,
|
| 182 |
+
"direct_distill:data_process": launch_data_process_task,
|
| 183 |
+
"sft": launch_training_task,
|
| 184 |
+
"sft:train": launch_training_task,
|
| 185 |
+
"direct_distill": launch_training_task,
|
| 186 |
+
"direct_distill:train": launch_training_task,
|
| 187 |
+
}
|
| 188 |
+
launcher_map[args.task](accelerator, dataset, model, model_logger, args=args)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_full/JoyAI-Echo-T2AV.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
from diffsynth import load_state_dict
|
| 5 |
+
|
| 6 |
+
vram_config = {
|
| 7 |
+
"offload_dtype": torch.bfloat16,
|
| 8 |
+
"offload_device": "cpu",
|
| 9 |
+
"onload_dtype": torch.bfloat16,
|
| 10 |
+
"onload_device": "cuda",
|
| 11 |
+
"preparing_dtype": torch.bfloat16,
|
| 12 |
+
"preparing_device": "cuda",
|
| 13 |
+
"computation_dtype": torch.bfloat16,
|
| 14 |
+
"computation_device": "cuda",
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 18 |
+
torch_dtype=torch.bfloat16,
|
| 19 |
+
device="cuda",
|
| 20 |
+
model_configs=[
|
| 21 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="jd-opensource/JoyAI-Echo", origin_file_pattern="JoyAI-Echo-release.safetensors", **vram_config),
|
| 23 |
+
|
| 24 |
+
],
|
| 25 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
state_dict = load_state_dict("models/train/JoyAI-Echo-T2AV-full/epoch-4.safetensors")
|
| 29 |
+
pipe.dit.load_state_dict(state_dict)
|
| 30 |
+
|
| 31 |
+
prompt = "A beautiful sunset over the ocean."
|
| 32 |
+
|
| 33 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 34 |
+
height, width, num_frames = 512, 768, 121
|
| 35 |
+
video, audio = pipe(
|
| 36 |
+
prompt=prompt,
|
| 37 |
+
negative_prompt=negative_prompt,
|
| 38 |
+
seed=43,
|
| 39 |
+
height=height,
|
| 40 |
+
width=width,
|
| 41 |
+
num_frames=num_frames,
|
| 42 |
+
use_distilled_pipeline=True,
|
| 43 |
+
tiled=True,
|
| 44 |
+
)
|
| 45 |
+
write_video_audio_ltx2(
|
| 46 |
+
video=video,
|
| 47 |
+
audio=audio,
|
| 48 |
+
output_path='joyai_echo.mp4',
|
| 49 |
+
fps=24,
|
| 50 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 51 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_full/LTX-2-T2AV.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
|
| 5 |
+
vram_config = {
|
| 6 |
+
"offload_dtype": torch.bfloat16,
|
| 7 |
+
"offload_device": "cpu",
|
| 8 |
+
"onload_dtype": torch.bfloat16,
|
| 9 |
+
"onload_device": "cuda",
|
| 10 |
+
"preparing_dtype": torch.bfloat16,
|
| 11 |
+
"preparing_device": "cuda",
|
| 12 |
+
"computation_dtype": torch.bfloat16,
|
| 13 |
+
"computation_device": "cuda",
|
| 14 |
+
}
|
| 15 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 16 |
+
torch_dtype=torch.bfloat16,
|
| 17 |
+
device="cuda",
|
| 18 |
+
model_configs=[
|
| 19 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 20 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="text_encoder_post_modules.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="video_vae_decoder.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="audio_vae_decoder.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="audio_vocoder.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(path="./models/train/LTX2-T2AV-full/epoch-4.safetensors", **vram_config),
|
| 25 |
+
],
|
| 26 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 27 |
+
)
|
| 28 |
+
prompt = "A beautiful sunset over the ocean."
|
| 29 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 30 |
+
height, width, num_frames = 512, 768, 121
|
| 31 |
+
video, audio = pipe(
|
| 32 |
+
prompt=prompt,
|
| 33 |
+
negative_prompt=negative_prompt,
|
| 34 |
+
seed=43,
|
| 35 |
+
height=height,
|
| 36 |
+
width=width,
|
| 37 |
+
num_frames=num_frames,
|
| 38 |
+
tiled=True,
|
| 39 |
+
cfg_scale=4.0
|
| 40 |
+
)
|
| 41 |
+
write_video_audio_ltx2(
|
| 42 |
+
video=video,
|
| 43 |
+
audio=audio,
|
| 44 |
+
output_path='ltx2_onestage.mp4',
|
| 45 |
+
fps=24,
|
| 46 |
+
audio_sample_rate=24000,
|
| 47 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_full/LTX-2.3-I2AV.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
from diffsynth.utils.data import VideoData
|
| 5 |
+
|
| 6 |
+
vram_config = {
|
| 7 |
+
"offload_dtype": torch.bfloat16,
|
| 8 |
+
"offload_device": "cpu",
|
| 9 |
+
"onload_dtype": torch.bfloat16,
|
| 10 |
+
"onload_device": "cuda",
|
| 11 |
+
"preparing_dtype": torch.bfloat16,
|
| 12 |
+
"preparing_device": "cuda",
|
| 13 |
+
"computation_dtype": torch.bfloat16,
|
| 14 |
+
"computation_device": "cuda",
|
| 15 |
+
}
|
| 16 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 17 |
+
torch_dtype=torch.bfloat16,
|
| 18 |
+
device="cuda",
|
| 19 |
+
model_configs=[
|
| 20 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="text_encoder_post_modules.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="video_vae_decoder.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="audio_vae_decoder.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="audio_vocoder.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(path="./models/train/LTX2.3-I2AV-full/epoch-4.safetensors", **vram_config),
|
| 26 |
+
],
|
| 27 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
prompt = "A beautiful sunset over the ocean."
|
| 31 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 32 |
+
height, width, num_frames = 512, 768, 121
|
| 33 |
+
image = VideoData("data/example_video_dataset/ltx2/video.mp4", height=height, width=width)[0]
|
| 34 |
+
# first frame
|
| 35 |
+
video, audio = pipe(
|
| 36 |
+
prompt=prompt,
|
| 37 |
+
negative_prompt=negative_prompt,
|
| 38 |
+
seed=43,
|
| 39 |
+
height=height,
|
| 40 |
+
width=width,
|
| 41 |
+
num_frames=num_frames,
|
| 42 |
+
tiled=False,
|
| 43 |
+
input_images=[image],
|
| 44 |
+
input_images_indexes=[0],
|
| 45 |
+
input_images_strength=1.0,
|
| 46 |
+
num_inference_steps=40,
|
| 47 |
+
)
|
| 48 |
+
write_video_audio_ltx2(
|
| 49 |
+
video=video,
|
| 50 |
+
audio=audio,
|
| 51 |
+
output_path='ltx2.3_onestage_i2av_first.mp4',
|
| 52 |
+
fps=24,
|
| 53 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 54 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_full/LTX-2.3-T2AV.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
|
| 5 |
+
vram_config = {
|
| 6 |
+
"offload_dtype": torch.bfloat16,
|
| 7 |
+
"offload_device": "cpu",
|
| 8 |
+
"onload_dtype": torch.bfloat16,
|
| 9 |
+
"onload_device": "cuda",
|
| 10 |
+
"preparing_dtype": torch.bfloat16,
|
| 11 |
+
"preparing_device": "cuda",
|
| 12 |
+
"computation_dtype": torch.bfloat16,
|
| 13 |
+
"computation_device": "cuda",
|
| 14 |
+
}
|
| 15 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 16 |
+
torch_dtype=torch.bfloat16,
|
| 17 |
+
device="cuda",
|
| 18 |
+
model_configs=[
|
| 19 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 20 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="text_encoder_post_modules.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="video_vae_decoder.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="audio_vae_decoder.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="audio_vocoder.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(path="./models/train/LTX2.3-T2AV-full/epoch-4.safetensors", **vram_config),
|
| 25 |
+
],
|
| 26 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 27 |
+
)
|
| 28 |
+
prompt = "A beautiful sunset over the ocean."
|
| 29 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 30 |
+
height, width, num_frames = 512, 768, 121
|
| 31 |
+
video, audio = pipe(
|
| 32 |
+
prompt=prompt,
|
| 33 |
+
negative_prompt=negative_prompt,
|
| 34 |
+
seed=43,
|
| 35 |
+
height=height,
|
| 36 |
+
width=width,
|
| 37 |
+
num_frames=num_frames,
|
| 38 |
+
tiled=True,
|
| 39 |
+
cfg_scale=4.0
|
| 40 |
+
)
|
| 41 |
+
write_video_audio_ltx2(
|
| 42 |
+
video=video,
|
| 43 |
+
audio=audio,
|
| 44 |
+
output_path='ltx2_onestage.mp4',
|
| 45 |
+
fps=24,
|
| 46 |
+
audio_sample_rate=24000,
|
| 47 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/JoyAI-Echo-T2AV.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
|
| 5 |
+
vram_config = {
|
| 6 |
+
"offload_dtype": torch.bfloat16,
|
| 7 |
+
"offload_device": "cpu",
|
| 8 |
+
"onload_dtype": torch.bfloat16,
|
| 9 |
+
"onload_device": "cuda",
|
| 10 |
+
"preparing_dtype": torch.bfloat16,
|
| 11 |
+
"preparing_device": "cuda",
|
| 12 |
+
"computation_dtype": torch.bfloat16,
|
| 13 |
+
"computation_device": "cuda",
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 17 |
+
torch_dtype=torch.bfloat16,
|
| 18 |
+
device="cuda",
|
| 19 |
+
model_configs=[
|
| 20 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="jd-opensource/JoyAI-Echo", origin_file_pattern="JoyAI-Echo-release.safetensors", **vram_config),
|
| 22 |
+
|
| 23 |
+
],
|
| 24 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
pipe.load_lora(pipe.dit, "models/train/JoyAI-Echo-T2AV_lora/epoch-4.safetensors")
|
| 28 |
+
|
| 29 |
+
prompt = "A beautiful sunset over the ocean."
|
| 30 |
+
|
| 31 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 32 |
+
height, width, num_frames = 512, 768, 121
|
| 33 |
+
video, audio = pipe(
|
| 34 |
+
prompt=prompt,
|
| 35 |
+
negative_prompt=negative_prompt,
|
| 36 |
+
seed=43,
|
| 37 |
+
height=height,
|
| 38 |
+
width=width,
|
| 39 |
+
num_frames=num_frames,
|
| 40 |
+
use_distilled_pipeline=True,
|
| 41 |
+
tiled=True,
|
| 42 |
+
)
|
| 43 |
+
write_video_audio_ltx2(
|
| 44 |
+
video=video,
|
| 45 |
+
audio=audio,
|
| 46 |
+
output_path='joyai_echo.mp4',
|
| 47 |
+
fps=24,
|
| 48 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 49 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2-T2AV-IC-LoRA.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
from diffsynth.utils.data import VideoData
|
| 5 |
+
|
| 6 |
+
vram_config = {
|
| 7 |
+
"offload_dtype": torch.bfloat16,
|
| 8 |
+
"offload_device": "cpu",
|
| 9 |
+
"onload_dtype": torch.bfloat16,
|
| 10 |
+
"onload_device": "cuda",
|
| 11 |
+
"preparing_dtype": torch.bfloat16,
|
| 12 |
+
"preparing_device": "cuda",
|
| 13 |
+
"computation_dtype": torch.bfloat16,
|
| 14 |
+
"computation_device": "cuda",
|
| 15 |
+
}
|
| 16 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 17 |
+
torch_dtype=torch.bfloat16,
|
| 18 |
+
device="cuda",
|
| 19 |
+
model_configs=[
|
| 20 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="transformer.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="text_encoder_post_modules.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="video_vae_decoder.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="audio_vae_decoder.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="audio_vocoder.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="video_vae_encoder.safetensors", **vram_config),
|
| 27 |
+
],
|
| 28 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 29 |
+
)
|
| 30 |
+
pipe.load_lora(pipe.dit, "./models/train/LTX2-T2AV-IC-LoRA/epoch-4.safetensors")
|
| 31 |
+
prompt = "[VISUAL]:Two cute orange cats, wearing boxing gloves, stand on a boxing ring and fight each other. [SOUNDS]:the sound of two cats boxing"
|
| 32 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 33 |
+
height, width, num_frames = 512, 768, 81
|
| 34 |
+
ref_scale_factor = 2
|
| 35 |
+
frame_rate = 24
|
| 36 |
+
input_video = VideoData("data/example_video_dataset/ltx2/depth_video.mp4", height=height // ref_scale_factor // 2, width=width // ref_scale_factor // 2)
|
| 37 |
+
input_video = input_video.raw_data()
|
| 38 |
+
video, audio = pipe(
|
| 39 |
+
prompt=prompt,
|
| 40 |
+
negative_prompt=negative_prompt,
|
| 41 |
+
seed=43,
|
| 42 |
+
height=height,
|
| 43 |
+
width=width,
|
| 44 |
+
num_frames=num_frames,
|
| 45 |
+
frame_rate=frame_rate,
|
| 46 |
+
tiled=True,
|
| 47 |
+
in_context_videos=[input_video],
|
| 48 |
+
in_context_downsample_factor=ref_scale_factor,
|
| 49 |
+
)
|
| 50 |
+
write_video_audio_ltx2(
|
| 51 |
+
video=video,
|
| 52 |
+
audio=audio,
|
| 53 |
+
output_path='ltx2_onestage_ic.mp4',
|
| 54 |
+
fps=frame_rate,
|
| 55 |
+
audio_sample_rate=24000,
|
| 56 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2-T2AV.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
|
| 5 |
+
vram_config = {
|
| 6 |
+
"offload_dtype": torch.bfloat16,
|
| 7 |
+
"offload_device": "cpu",
|
| 8 |
+
"onload_dtype": torch.bfloat16,
|
| 9 |
+
"onload_device": "cuda",
|
| 10 |
+
"preparing_dtype": torch.bfloat16,
|
| 11 |
+
"preparing_device": "cuda",
|
| 12 |
+
"computation_dtype": torch.bfloat16,
|
| 13 |
+
"computation_device": "cuda",
|
| 14 |
+
}
|
| 15 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 16 |
+
torch_dtype=torch.bfloat16,
|
| 17 |
+
device="cuda",
|
| 18 |
+
model_configs=[
|
| 19 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 20 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="transformer.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="text_encoder_post_modules.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="video_vae_decoder.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="audio_vae_decoder.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="audio_vocoder.safetensors", **vram_config),
|
| 25 |
+
],
|
| 26 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 27 |
+
)
|
| 28 |
+
pipe.load_lora(pipe.dit, "models/train/LTX2-T2AV_lora/epoch-4.safetensors")
|
| 29 |
+
prompt = "A beautiful sunset over the ocean."
|
| 30 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 31 |
+
height, width, num_frames = 512, 768, 121
|
| 32 |
+
video, audio = pipe(
|
| 33 |
+
prompt=prompt,
|
| 34 |
+
negative_prompt=negative_prompt,
|
| 35 |
+
seed=43,
|
| 36 |
+
height=height,
|
| 37 |
+
width=width,
|
| 38 |
+
num_frames=num_frames,
|
| 39 |
+
tiled=True,
|
| 40 |
+
cfg_scale=4.0
|
| 41 |
+
)
|
| 42 |
+
write_video_audio_ltx2(
|
| 43 |
+
video=video,
|
| 44 |
+
audio=audio,
|
| 45 |
+
output_path='ltx2_onestage.mp4',
|
| 46 |
+
fps=24,
|
| 47 |
+
audio_sample_rate=24000,
|
| 48 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2-T2AV_noaudio.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
|
| 5 |
+
vram_config = {
|
| 6 |
+
"offload_dtype": torch.bfloat16,
|
| 7 |
+
"offload_device": "cpu",
|
| 8 |
+
"onload_dtype": torch.bfloat16,
|
| 9 |
+
"onload_device": "cuda",
|
| 10 |
+
"preparing_dtype": torch.bfloat16,
|
| 11 |
+
"preparing_device": "cuda",
|
| 12 |
+
"computation_dtype": torch.bfloat16,
|
| 13 |
+
"computation_device": "cuda",
|
| 14 |
+
}
|
| 15 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 16 |
+
torch_dtype=torch.bfloat16,
|
| 17 |
+
device="cuda",
|
| 18 |
+
model_configs=[
|
| 19 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 20 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="transformer.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="text_encoder_post_modules.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="video_vae_decoder.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="audio_vae_decoder.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2-Repackage", origin_file_pattern="audio_vocoder.safetensors", **vram_config),
|
| 25 |
+
],
|
| 26 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 27 |
+
)
|
| 28 |
+
pipe.load_lora(pipe.dit, "models/train/LTX2-T2AV-noaudio_lora/epoch-4.safetensors")
|
| 29 |
+
prompt = "A beautiful sunset over the ocean."
|
| 30 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 31 |
+
height, width, num_frames = 512, 768, 121
|
| 32 |
+
video, audio = pipe(
|
| 33 |
+
prompt=prompt,
|
| 34 |
+
negative_prompt=negative_prompt,
|
| 35 |
+
seed=43,
|
| 36 |
+
height=height,
|
| 37 |
+
width=width,
|
| 38 |
+
num_frames=num_frames,
|
| 39 |
+
tiled=True,
|
| 40 |
+
cfg_scale=4.0
|
| 41 |
+
)
|
| 42 |
+
write_video_audio_ltx2(
|
| 43 |
+
video=video,
|
| 44 |
+
audio=audio,
|
| 45 |
+
output_path='ltx2_onestage.mp4',
|
| 46 |
+
fps=24,
|
| 47 |
+
audio_sample_rate=24000,
|
| 48 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2.3-I2AV.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
from diffsynth.utils.data import VideoData
|
| 5 |
+
|
| 6 |
+
vram_config = {
|
| 7 |
+
"offload_dtype": torch.bfloat16,
|
| 8 |
+
"offload_device": "cpu",
|
| 9 |
+
"onload_dtype": torch.bfloat16,
|
| 10 |
+
"onload_device": "cuda",
|
| 11 |
+
"preparing_dtype": torch.bfloat16,
|
| 12 |
+
"preparing_device": "cuda",
|
| 13 |
+
"computation_dtype": torch.bfloat16,
|
| 14 |
+
"computation_device": "cuda",
|
| 15 |
+
}
|
| 16 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 17 |
+
torch_dtype=torch.bfloat16,
|
| 18 |
+
device="cuda",
|
| 19 |
+
model_configs=[
|
| 20 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="transformer.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="text_encoder_post_modules.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="video_vae_decoder.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="audio_vae_decoder.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="audio_vocoder.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="video_vae_encoder.safetensors", **vram_config),
|
| 27 |
+
],
|
| 28 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 29 |
+
)
|
| 30 |
+
pipe.load_lora(pipe.dit, "models/train/LTX2.3-I2AV_lora/epoch-4.safetensors")
|
| 31 |
+
|
| 32 |
+
prompt = "A beautiful sunset over the ocean."
|
| 33 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 34 |
+
height, width, num_frames = 512, 768, 121
|
| 35 |
+
image = VideoData("data/example_video_dataset/ltx2/video.mp4", height=height, width=width)[0]
|
| 36 |
+
# first frame
|
| 37 |
+
video, audio = pipe(
|
| 38 |
+
prompt=prompt,
|
| 39 |
+
negative_prompt=negative_prompt,
|
| 40 |
+
seed=43,
|
| 41 |
+
height=height,
|
| 42 |
+
width=width,
|
| 43 |
+
num_frames=num_frames,
|
| 44 |
+
tiled=False,
|
| 45 |
+
input_images=[image],
|
| 46 |
+
input_images_indexes=[0],
|
| 47 |
+
input_images_strength=1.0,
|
| 48 |
+
num_inference_steps=40,
|
| 49 |
+
)
|
| 50 |
+
write_video_audio_ltx2(
|
| 51 |
+
video=video,
|
| 52 |
+
audio=audio,
|
| 53 |
+
output_path='ltx2.3_onestage_i2av_first.mp4',
|
| 54 |
+
fps=24,
|
| 55 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 56 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2.3-T2AV-IC-LoRA.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
from diffsynth.utils.data import VideoData
|
| 5 |
+
|
| 6 |
+
vram_config = {
|
| 7 |
+
"offload_dtype": torch.bfloat16,
|
| 8 |
+
"offload_device": "cpu",
|
| 9 |
+
"onload_dtype": torch.bfloat16,
|
| 10 |
+
"onload_device": "cuda",
|
| 11 |
+
"preparing_dtype": torch.bfloat16,
|
| 12 |
+
"preparing_device": "cuda",
|
| 13 |
+
"computation_dtype": torch.bfloat16,
|
| 14 |
+
"computation_device": "cuda",
|
| 15 |
+
}
|
| 16 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 17 |
+
torch_dtype=torch.bfloat16,
|
| 18 |
+
device="cuda",
|
| 19 |
+
model_configs=[
|
| 20 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="transformer.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="text_encoder_post_modules.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="video_vae_decoder.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="audio_vae_decoder.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="audio_vocoder.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="video_vae_encoder.safetensors", **vram_config),
|
| 27 |
+
],
|
| 28 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 29 |
+
)
|
| 30 |
+
pipe.load_lora(pipe.dit, "./models/train/LTX2.3-T2AV-IC-LoRA/epoch-4.safetensors")
|
| 31 |
+
prompt = "[VISUAL]:Two cute orange cats, wearing boxing gloves, stand on a boxing ring and fight each other. [SOUNDS]:the sound of two cats boxing"
|
| 32 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 33 |
+
height, width, num_frames = 512, 768, 81
|
| 34 |
+
ref_scale_factor = 2
|
| 35 |
+
frame_rate = 24
|
| 36 |
+
input_video = VideoData("data/example_video_dataset/ltx2/depth_video.mp4", height=height // ref_scale_factor // 2, width=width // ref_scale_factor // 2)
|
| 37 |
+
input_video = input_video.raw_data()
|
| 38 |
+
video, audio = pipe(
|
| 39 |
+
prompt=prompt,
|
| 40 |
+
negative_prompt=negative_prompt,
|
| 41 |
+
seed=43,
|
| 42 |
+
height=height,
|
| 43 |
+
width=width,
|
| 44 |
+
num_frames=num_frames,
|
| 45 |
+
frame_rate=frame_rate,
|
| 46 |
+
tiled=True,
|
| 47 |
+
in_context_videos=[input_video],
|
| 48 |
+
in_context_downsample_factor=ref_scale_factor,
|
| 49 |
+
)
|
| 50 |
+
write_video_audio_ltx2(
|
| 51 |
+
video=video,
|
| 52 |
+
audio=audio,
|
| 53 |
+
output_path='ltx2.3_onestage_ic.mp4',
|
| 54 |
+
fps=frame_rate,
|
| 55 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 56 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/ltx2/model_training/validate_lora/LTX-2.3-T2AV.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from diffsynth.pipelines.ltx2_audio_video import LTX2AudioVideoPipeline, ModelConfig
|
| 3 |
+
from diffsynth.utils.data.media_io_ltx2 import write_video_audio_ltx2
|
| 4 |
+
|
| 5 |
+
vram_config = {
|
| 6 |
+
"offload_dtype": torch.bfloat16,
|
| 7 |
+
"offload_device": "cpu",
|
| 8 |
+
"onload_dtype": torch.bfloat16,
|
| 9 |
+
"onload_device": "cuda",
|
| 10 |
+
"preparing_dtype": torch.bfloat16,
|
| 11 |
+
"preparing_device": "cuda",
|
| 12 |
+
"computation_dtype": torch.bfloat16,
|
| 13 |
+
"computation_device": "cuda",
|
| 14 |
+
}
|
| 15 |
+
pipe = LTX2AudioVideoPipeline.from_pretrained(
|
| 16 |
+
torch_dtype=torch.bfloat16,
|
| 17 |
+
device="cuda",
|
| 18 |
+
model_configs=[
|
| 19 |
+
ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized", origin_file_pattern="model-*.safetensors", **vram_config),
|
| 20 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="transformer.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="text_encoder_post_modules.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="video_vae_decoder.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="audio_vae_decoder.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="DiffSynth-Studio/LTX-2.3-Repackage", origin_file_pattern="audio_vocoder.safetensors", **vram_config),
|
| 25 |
+
],
|
| 26 |
+
tokenizer_config=ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized"),
|
| 27 |
+
)
|
| 28 |
+
pipe.load_lora(pipe.dit, "models/train/LTX2.3-T2AV_lora/epoch-4.safetensors")
|
| 29 |
+
prompt = "A beautiful sunset over the ocean."
|
| 30 |
+
negative_prompt = "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
|
| 31 |
+
height, width, num_frames = 512, 768, 121
|
| 32 |
+
video, audio = pipe(
|
| 33 |
+
prompt=prompt,
|
| 34 |
+
negative_prompt=negative_prompt,
|
| 35 |
+
seed=43,
|
| 36 |
+
height=height,
|
| 37 |
+
width=width,
|
| 38 |
+
num_frames=num_frames,
|
| 39 |
+
tiled=True,
|
| 40 |
+
cfg_scale=4.0
|
| 41 |
+
)
|
| 42 |
+
write_video_audio_ltx2(
|
| 43 |
+
video=video,
|
| 44 |
+
audio=audio,
|
| 45 |
+
output_path='ltx2_onestage.mp4',
|
| 46 |
+
fps=24,
|
| 47 |
+
audio_sample_rate=pipe.audio_vocoder.output_sampling_rate,
|
| 48 |
+
)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
English Document: https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Wan.html
|
| 2 |
+
|
| 3 |
+
中文文档:https://diffsynth-studio-doc.readthedocs.io/zh-cn/latest/Model_Details/Wan.html
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/acceleration/unified_sequence_parallel.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from PIL import Image
|
| 3 |
+
from diffsynth.utils.data.audio_video import write_video_audio
|
| 4 |
+
from diffsynth.pipelines.mova_audio_video import MovaAudioVideoPipeline, ModelConfig
|
| 5 |
+
import torch.distributed as dist
|
| 6 |
+
|
| 7 |
+
vram_config = {
|
| 8 |
+
"offload_dtype": torch.bfloat16,
|
| 9 |
+
"offload_device": "cpu",
|
| 10 |
+
"onload_dtype": torch.bfloat16,
|
| 11 |
+
"onload_device": "cuda",
|
| 12 |
+
"preparing_dtype": torch.bfloat16,
|
| 13 |
+
"preparing_device": "cuda",
|
| 14 |
+
"computation_dtype": torch.bfloat16,
|
| 15 |
+
"computation_device": "cuda",
|
| 16 |
+
}
|
| 17 |
+
pipe = MovaAudioVideoPipeline.from_pretrained(
|
| 18 |
+
torch_dtype=torch.bfloat16,
|
| 19 |
+
device="cuda",
|
| 20 |
+
use_usp=True,
|
| 21 |
+
model_configs=[
|
| 22 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="video_dit/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="video_dit_2/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="audio_dit/diffusion_pytorch_model.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="dual_tower_bridge/diffusion_pytorch_model.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_vae/diffusion_pytorch_model.safetensors", **vram_config),
|
| 27 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="Wan2.1_VAE.safetensors", **vram_config),
|
| 28 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="models_t5_umt5-xxl-enc-bf16.safetensors", **vram_config),
|
| 29 |
+
],
|
| 30 |
+
tokenizer_config=ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="tokenizer/"),
|
| 31 |
+
)
|
| 32 |
+
negative_prompt = (
|
| 33 |
+
"色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,"
|
| 34 |
+
"整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指"
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
prompt = "Two cute orange cats, wearing boxing gloves, stand on a boxing ring and fight each other."
|
| 38 |
+
height, width, num_frames = 352, 640, 121
|
| 39 |
+
frame_rate=24
|
| 40 |
+
input_image = Image.open("data/examples/wan/cat_fightning.jpg").resize((width, height)).convert("RGB")
|
| 41 |
+
# Image-to-video
|
| 42 |
+
video, audio = pipe(
|
| 43 |
+
prompt=prompt,
|
| 44 |
+
negative_prompt=negative_prompt,
|
| 45 |
+
height=height,
|
| 46 |
+
width=width,
|
| 47 |
+
num_frames=num_frames,
|
| 48 |
+
input_image=input_image,
|
| 49 |
+
num_inference_steps=50,
|
| 50 |
+
seed=0,
|
| 51 |
+
tiled=True,
|
| 52 |
+
frame_rate=frame_rate,
|
| 53 |
+
)
|
| 54 |
+
if dist.get_rank() == 0:
|
| 55 |
+
write_video_audio(video, audio, "MOVA-360p-cat.mp4", fps=24, audio_sample_rate=pipe.audio_vae.sample_rate)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_inference/MOVA-360p-I2AV.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from PIL import Image
|
| 3 |
+
from diffsynth.pipelines.mova_audio_video import ModelConfig, MovaAudioVideoPipeline
|
| 4 |
+
from diffsynth.utils.data.audio_video import write_video_audio
|
| 5 |
+
|
| 6 |
+
vram_config = {
|
| 7 |
+
"offload_dtype": torch.bfloat16,
|
| 8 |
+
"offload_device": "cpu",
|
| 9 |
+
"onload_dtype": torch.bfloat16,
|
| 10 |
+
"onload_device": "cuda",
|
| 11 |
+
"preparing_dtype": torch.bfloat16,
|
| 12 |
+
"preparing_device": "cuda",
|
| 13 |
+
"computation_dtype": torch.bfloat16,
|
| 14 |
+
"computation_device": "cuda",
|
| 15 |
+
}
|
| 16 |
+
pipe = MovaAudioVideoPipeline.from_pretrained(
|
| 17 |
+
torch_dtype=torch.bfloat16,
|
| 18 |
+
device="cuda",
|
| 19 |
+
model_configs=[
|
| 20 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="video_dit/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="video_dit_2/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="audio_dit/diffusion_pytorch_model.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="dual_tower_bridge/diffusion_pytorch_model.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_vae/diffusion_pytorch_model.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="Wan2.1_VAE.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="models_t5_umt5-xxl-enc-bf16.safetensors", **vram_config),
|
| 27 |
+
],
|
| 28 |
+
tokenizer_config=ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="tokenizer/"),
|
| 29 |
+
)
|
| 30 |
+
negative_prompt = (
|
| 31 |
+
"色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,"
|
| 32 |
+
"整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指"
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
prompt = "Two cute orange cats, wearing boxing gloves, stand on a boxing ring and fight each other."
|
| 36 |
+
height, width, num_frames = 352, 640, 121
|
| 37 |
+
frame_rate = 24
|
| 38 |
+
input_image = Image.open("data/examples/wan/cat_fightning.jpg").resize((width, height)).convert("RGB")
|
| 39 |
+
# Image-to-video
|
| 40 |
+
video, audio = pipe(
|
| 41 |
+
prompt=prompt,
|
| 42 |
+
negative_prompt=negative_prompt,
|
| 43 |
+
height=height,
|
| 44 |
+
width=width,
|
| 45 |
+
num_frames=num_frames,
|
| 46 |
+
input_image=input_image,
|
| 47 |
+
num_inference_steps=50,
|
| 48 |
+
seed=0,
|
| 49 |
+
tiled=True,
|
| 50 |
+
frame_rate=frame_rate,
|
| 51 |
+
)
|
| 52 |
+
write_video_audio(video, audio, "MOVA-360p-cat.mp4", fps=24, audio_sample_rate=pipe.audio_vae.sample_rate)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_inference/MOVA-720p-I2AV.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from PIL import Image
|
| 3 |
+
from diffsynth.utils.data.audio_video import write_video_audio
|
| 4 |
+
from diffsynth.pipelines.mova_audio_video import MovaAudioVideoPipeline, ModelConfig
|
| 5 |
+
|
| 6 |
+
vram_config = {
|
| 7 |
+
"offload_dtype": torch.bfloat16,
|
| 8 |
+
"offload_device": "cpu",
|
| 9 |
+
"onload_dtype": torch.bfloat16,
|
| 10 |
+
"onload_device": "cuda",
|
| 11 |
+
"preparing_dtype": torch.bfloat16,
|
| 12 |
+
"preparing_device": "cuda",
|
| 13 |
+
"computation_dtype": torch.bfloat16,
|
| 14 |
+
"computation_device": "cuda",
|
| 15 |
+
}
|
| 16 |
+
pipe = MovaAudioVideoPipeline.from_pretrained(
|
| 17 |
+
torch_dtype=torch.bfloat16,
|
| 18 |
+
device="cuda",
|
| 19 |
+
model_configs=[
|
| 20 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="video_dit/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="video_dit_2/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_dit/diffusion_pytorch_model.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="dual_tower_bridge/diffusion_pytorch_model.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_vae/diffusion_pytorch_model.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="Wan2.1_VAE.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="models_t5_umt5-xxl-enc-bf16.safetensors", **vram_config),
|
| 27 |
+
],
|
| 28 |
+
tokenizer_config=ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="tokenizer/"),
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
negative_prompt = (
|
| 32 |
+
"色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,"
|
| 33 |
+
"整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指"
|
| 34 |
+
)
|
| 35 |
+
prompt = "Two cute orange cats, wearing boxing gloves, stand on a boxing ring and fight each other."
|
| 36 |
+
height, width, num_frames = 720, 1280, 121
|
| 37 |
+
frame_rate = 24
|
| 38 |
+
input_image = Image.open("data/examples/wan/cat_fightning.jpg").resize((width, height)).convert("RGB")
|
| 39 |
+
# Image-to-video
|
| 40 |
+
video, audio = pipe(
|
| 41 |
+
prompt=prompt,
|
| 42 |
+
negative_prompt=negative_prompt,
|
| 43 |
+
height=height,
|
| 44 |
+
width=width,
|
| 45 |
+
num_frames=num_frames,
|
| 46 |
+
input_image=input_image,
|
| 47 |
+
num_inference_steps=50,
|
| 48 |
+
seed=0,
|
| 49 |
+
tiled=True,
|
| 50 |
+
frame_rate=frame_rate,
|
| 51 |
+
)
|
| 52 |
+
write_video_audio(video, audio, "MOVA-720p-cat.mp4", fps=24, audio_sample_rate=pipe.audio_vae.sample_rate)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_inference_low_vram/MOVA-360p-I2AV.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from PIL import Image
|
| 3 |
+
from diffsynth.pipelines.mova_audio_video import ModelConfig, MovaAudioVideoPipeline
|
| 4 |
+
from diffsynth.utils.data.audio_video import write_video_audio
|
| 5 |
+
|
| 6 |
+
vram_config = {
|
| 7 |
+
"offload_dtype": torch.bfloat16,
|
| 8 |
+
"offload_device": "cpu",
|
| 9 |
+
"onload_dtype": torch.bfloat16,
|
| 10 |
+
"onload_device": "cuda",
|
| 11 |
+
"preparing_dtype": torch.bfloat16,
|
| 12 |
+
"preparing_device": "cuda",
|
| 13 |
+
"computation_dtype": torch.bfloat16,
|
| 14 |
+
"computation_device": "cuda",
|
| 15 |
+
}
|
| 16 |
+
pipe = MovaAudioVideoPipeline.from_pretrained(
|
| 17 |
+
torch_dtype=torch.bfloat16,
|
| 18 |
+
device="cuda",
|
| 19 |
+
model_configs=[
|
| 20 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="video_dit/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="video_dit_2/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="audio_dit/diffusion_pytorch_model.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="dual_tower_bridge/diffusion_pytorch_model.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_vae/diffusion_pytorch_model.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="Wan2.1_VAE.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="models_t5_umt5-xxl-enc-bf16.safetensors", **vram_config),
|
| 27 |
+
],
|
| 28 |
+
tokenizer_config=ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="tokenizer/"),
|
| 29 |
+
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 2,
|
| 30 |
+
)
|
| 31 |
+
negative_prompt = (
|
| 32 |
+
"色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,"
|
| 33 |
+
"整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指"
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
prompt = "Two cute orange cats, wearing boxing gloves, stand on a boxing ring and fight each other."
|
| 37 |
+
height, width, num_frames = 352, 640, 121
|
| 38 |
+
frame_rate = 24
|
| 39 |
+
input_image = Image.open("data/examples/wan/cat_fightning.jpg").resize((width, height)).convert("RGB")
|
| 40 |
+
# Image-to-video
|
| 41 |
+
video, audio = pipe(
|
| 42 |
+
prompt=prompt,
|
| 43 |
+
negative_prompt=negative_prompt,
|
| 44 |
+
height=height,
|
| 45 |
+
width=width,
|
| 46 |
+
num_frames=num_frames,
|
| 47 |
+
input_image=input_image,
|
| 48 |
+
num_inference_steps=50,
|
| 49 |
+
seed=0,
|
| 50 |
+
tiled=True,
|
| 51 |
+
frame_rate=frame_rate,
|
| 52 |
+
)
|
| 53 |
+
write_video_audio(video, audio, "MOVA-360p-cat.mp4", fps=24, audio_sample_rate=pipe.audio_vae.sample_rate)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_inference_low_vram/MOVA-720p-I2AV.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from PIL import Image
|
| 3 |
+
from diffsynth.utils.data.audio_video import write_video_audio
|
| 4 |
+
from diffsynth.pipelines.mova_audio_video import MovaAudioVideoPipeline, ModelConfig
|
| 5 |
+
|
| 6 |
+
vram_config = {
|
| 7 |
+
"offload_dtype": torch.bfloat16,
|
| 8 |
+
"offload_device": "cpu",
|
| 9 |
+
"onload_dtype": torch.bfloat16,
|
| 10 |
+
"onload_device": "cuda",
|
| 11 |
+
"preparing_dtype": torch.bfloat16,
|
| 12 |
+
"preparing_device": "cuda",
|
| 13 |
+
"computation_dtype": torch.bfloat16,
|
| 14 |
+
"computation_device": "cuda",
|
| 15 |
+
}
|
| 16 |
+
pipe = MovaAudioVideoPipeline.from_pretrained(
|
| 17 |
+
torch_dtype=torch.bfloat16,
|
| 18 |
+
device="cuda",
|
| 19 |
+
model_configs=[
|
| 20 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="video_dit/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 21 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="video_dit_2/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 22 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_dit/diffusion_pytorch_model.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="dual_tower_bridge/diffusion_pytorch_model.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_vae/diffusion_pytorch_model.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="Wan2.1_VAE.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="models_t5_umt5-xxl-enc-bf16.safetensors", **vram_config),
|
| 27 |
+
],
|
| 28 |
+
tokenizer_config=ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="tokenizer/"),
|
| 29 |
+
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 2,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
negative_prompt = (
|
| 33 |
+
"色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,"
|
| 34 |
+
"整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指"
|
| 35 |
+
)
|
| 36 |
+
prompt = "Two cute orange cats, wearing boxing gloves, stand on a boxing ring and fight each other."
|
| 37 |
+
height, width, num_frames = 720, 1280, 121
|
| 38 |
+
frame_rate = 24
|
| 39 |
+
input_image = Image.open("data/examples/wan/cat_fightning.jpg").resize((width, height)).convert("RGB")
|
| 40 |
+
# Image-to-video
|
| 41 |
+
video, audio = pipe(
|
| 42 |
+
prompt=prompt,
|
| 43 |
+
negative_prompt=negative_prompt,
|
| 44 |
+
height=height,
|
| 45 |
+
width=width,
|
| 46 |
+
num_frames=num_frames,
|
| 47 |
+
input_image=input_image,
|
| 48 |
+
num_inference_steps=50,
|
| 49 |
+
seed=0,
|
| 50 |
+
tiled=True,
|
| 51 |
+
frame_rate=frame_rate,
|
| 52 |
+
)
|
| 53 |
+
write_video_audio(video, audio, "MOVA-720p-cat.mp4", fps=24, audio_sample_rate=pipe.audio_vae.sample_rate)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/full/MOVA-360P-I2AV.sh
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "mova/MOVA-360P-I2AV/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
accelerate launch --config_file examples/wanvideo/model_training/full/accelerate_config_14B.yaml examples/mova/model_training/train.py \
|
| 4 |
+
--dataset_base_path data/diffsynth_example_dataset/mova/MOVA-360P-I2AV \
|
| 5 |
+
--dataset_metadata_path data/diffsynth_example_dataset/mova/MOVA-360P-I2AV/metadata.csv \
|
| 6 |
+
--data_file_keys "video,input_audio" \
|
| 7 |
+
--extra_inputs "input_audio,input_image" \
|
| 8 |
+
--height 352 \
|
| 9 |
+
--width 640 \
|
| 10 |
+
--num_frames 121 \
|
| 11 |
+
--dataset_repeat 100 \
|
| 12 |
+
--model_id_with_origin_paths "openmoss/MOVA-360p:video_dit/diffusion_pytorch_model-*.safetensors,openmoss/MOVA-360p:audio_dit/diffusion_pytorch_model.safetensors,openmoss/MOVA-360p:dual_tower_bridge/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:audio_vae/diffusion_pytorch_model.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:Wan2.1_VAE.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:models_t5_umt5-xxl-enc-bf16.safetensors" \
|
| 13 |
+
--learning_rate 1e-4 \
|
| 14 |
+
--num_epochs 5 \
|
| 15 |
+
--remove_prefix_in_ckpt "pipe.video_dit." \
|
| 16 |
+
--output_path "./models/train/MOVA-360p-I2AV_high_noise_full" \
|
| 17 |
+
--trainable_models "dit" \
|
| 18 |
+
--max_timestep_boundary 0.358 \
|
| 19 |
+
--min_timestep_boundary 0 \
|
| 20 |
+
--use_gradient_checkpointing
|
| 21 |
+
# boundary corresponds to timesteps [900, 1000]
|
| 22 |
+
|
| 23 |
+
accelerate launch --config_file examples/wanvideo/model_training/full/accelerate_config_14B.yaml examples/mova/model_training/train.py \
|
| 24 |
+
--dataset_base_path data/diffsynth_example_dataset/mova/MOVA-360P-I2AV \
|
| 25 |
+
--dataset_metadata_path data/diffsynth_example_dataset/mova/MOVA-360P-I2AV/metadata.csv \
|
| 26 |
+
--data_file_keys "video,input_audio" \
|
| 27 |
+
--extra_inputs "input_audio,input_image" \
|
| 28 |
+
--height 352 \
|
| 29 |
+
--width 640 \
|
| 30 |
+
--num_frames 121 \
|
| 31 |
+
--dataset_repeat 100 \
|
| 32 |
+
--model_id_with_origin_paths "openmoss/MOVA-360p:video_dit_2/diffusion_pytorch_model-*.safetensors,openmoss/MOVA-360p:audio_dit/diffusion_pytorch_model.safetensors,openmoss/MOVA-360p:dual_tower_bridge/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:audio_vae/diffusion_pytorch_model.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:Wan2.1_VAE.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:models_t5_umt5-xxl-enc-bf16.safetensors" \
|
| 33 |
+
--learning_rate 1e-4 \
|
| 34 |
+
--num_epochs 5 \
|
| 35 |
+
--remove_prefix_in_ckpt "pipe.video_dit." \
|
| 36 |
+
--output_path "./models/train/MOVA-360p-I2AV_low_noise_full" \
|
| 37 |
+
--trainable_models "dit" \
|
| 38 |
+
--max_timestep_boundary 1 \
|
| 39 |
+
--min_timestep_boundary 0.358 \
|
| 40 |
+
--use_gradient_checkpointing
|
| 41 |
+
# boundary corresponds to timesteps [0, 900)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/full/MOVA-720P-I2AV.sh
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "mova/MOVA-720P-I2AV/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
accelerate launch --config_file examples/wanvideo/model_training/full/accelerate_config_14B.yaml examples/mova/model_training/train.py \
|
| 4 |
+
--dataset_base_path data/diffsynth_example_dataset/mova/MOVA-720P-I2AV \
|
| 5 |
+
--dataset_metadata_path data/diffsynth_example_dataset/mova/MOVA-720P-I2AV/metadata.csv \
|
| 6 |
+
--data_file_keys "video,input_audio" \
|
| 7 |
+
--extra_inputs "input_audio,input_image" \
|
| 8 |
+
--height 720 \
|
| 9 |
+
--width 1280 \
|
| 10 |
+
--num_frames 121 \
|
| 11 |
+
--dataset_repeat 100 \
|
| 12 |
+
--model_id_with_origin_paths "openmoss/MOVA-720p:video_dit/diffusion_pytorch_model-*.safetensors,openmoss/MOVA-720p:audio_dit/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:dual_tower_bridge/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:audio_vae/diffusion_pytorch_model.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:Wan2.1_VAE.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:models_t5_umt5-xxl-enc-bf16.safetensors" \
|
| 13 |
+
--learning_rate 1e-4 \
|
| 14 |
+
--num_epochs 5 \
|
| 15 |
+
--remove_prefix_in_ckpt "pipe.video_dit." \
|
| 16 |
+
--output_path "./models/train/MOVA-720p-I2AV_high_noise_full" \
|
| 17 |
+
--trainable_models "dit" \
|
| 18 |
+
--max_timestep_boundary 0.358 \
|
| 19 |
+
--min_timestep_boundary 0 \
|
| 20 |
+
--use_gradient_checkpointing
|
| 21 |
+
# boundary corresponds to timesteps [900, 1000]
|
| 22 |
+
|
| 23 |
+
accelerate launch --config_file examples/wanvideo/model_training/full/accelerate_config_14B.yaml examples/mova/model_training/train.py \
|
| 24 |
+
--dataset_base_path data/diffsynth_example_dataset/mova/MOVA-720P-I2AV \
|
| 25 |
+
--dataset_metadata_path data/diffsynth_example_dataset/mova/MOVA-720P-I2AV/metadata.csv \
|
| 26 |
+
--data_file_keys "video,input_audio" \
|
| 27 |
+
--extra_inputs "input_audio,input_image" \
|
| 28 |
+
--height 720 \
|
| 29 |
+
--width 1280 \
|
| 30 |
+
--num_frames 121 \
|
| 31 |
+
--dataset_repeat 100 \
|
| 32 |
+
--model_id_with_origin_paths "openmoss/MOVA-720p:video_dit_2/diffusion_pytorch_model-*.safetensors,openmoss/MOVA-720p:audio_dit/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:dual_tower_bridge/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:audio_vae/diffusion_pytorch_model.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:Wan2.1_VAE.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:models_t5_umt5-xxl-enc-bf16.safetensors" \
|
| 33 |
+
--learning_rate 1e-4 \
|
| 34 |
+
--num_epochs 5 \
|
| 35 |
+
--remove_prefix_in_ckpt "pipe.video_dit." \
|
| 36 |
+
--output_path "./models/train/MOVA-720p-I2AV_low_noise_full" \
|
| 37 |
+
--trainable_models "dit" \
|
| 38 |
+
--max_timestep_boundary 1 \
|
| 39 |
+
--min_timestep_boundary 0.358 \
|
| 40 |
+
--use_gradient_checkpointing
|
| 41 |
+
# boundary corresponds to timesteps [0, 900)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/lora/MOVA-360P-I2AV.sh
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "mova/MOVA-360P-I2AV/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
accelerate launch examples/mova/model_training/train.py \
|
| 4 |
+
--dataset_base_path data/diffsynth_example_dataset/mova/MOVA-360P-I2AV \
|
| 5 |
+
--dataset_metadata_path data/diffsynth_example_dataset/mova/MOVA-360P-I2AV/metadata.csv \
|
| 6 |
+
--data_file_keys "video,input_audio" \
|
| 7 |
+
--extra_inputs "input_audio,input_image" \
|
| 8 |
+
--height 352 \
|
| 9 |
+
--width 640 \
|
| 10 |
+
--num_frames 121 \
|
| 11 |
+
--dataset_repeat 100 \
|
| 12 |
+
--model_id_with_origin_paths "openmoss/MOVA-360p:video_dit/diffusion_pytorch_model-*.safetensors,openmoss/MOVA-360p:audio_dit/diffusion_pytorch_model.safetensors,openmoss/MOVA-360p:dual_tower_bridge/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:audio_vae/diffusion_pytorch_model.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:Wan2.1_VAE.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:models_t5_umt5-xxl-enc-bf16.safetensors" \
|
| 13 |
+
--learning_rate 1e-4 \
|
| 14 |
+
--num_epochs 5 \
|
| 15 |
+
--remove_prefix_in_ckpt "pipe.video_dit." \
|
| 16 |
+
--output_path "./models/train/MOVA-360p-I2AV_high_noise_lora" \
|
| 17 |
+
--lora_base_model "video_dit" \
|
| 18 |
+
--lora_target_modules "q,k,v,o,ffn.0,ffn.2" \
|
| 19 |
+
--lora_rank 32 \
|
| 20 |
+
--max_timestep_boundary 0.358 \
|
| 21 |
+
--min_timestep_boundary 0 \
|
| 22 |
+
--use_gradient_checkpointing
|
| 23 |
+
# boundary corresponds to timesteps [900, 1000]
|
| 24 |
+
|
| 25 |
+
accelerate launch examples/mova/model_training/train.py \
|
| 26 |
+
--dataset_base_path data/diffsynth_example_dataset/mova/MOVA-360P-I2AV \
|
| 27 |
+
--dataset_metadata_path data/diffsynth_example_dataset/mova/MOVA-360P-I2AV/metadata.csv \
|
| 28 |
+
--data_file_keys "video,input_audio" \
|
| 29 |
+
--extra_inputs "input_audio,input_image" \
|
| 30 |
+
--height 352 \
|
| 31 |
+
--width 640 \
|
| 32 |
+
--num_frames 121 \
|
| 33 |
+
--dataset_repeat 100 \
|
| 34 |
+
--model_id_with_origin_paths "openmoss/MOVA-360p:video_dit_2/diffusion_pytorch_model-*.safetensors,openmoss/MOVA-360p:audio_dit/diffusion_pytorch_model.safetensors,openmoss/MOVA-360p:dual_tower_bridge/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:audio_vae/diffusion_pytorch_model.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:Wan2.1_VAE.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:models_t5_umt5-xxl-enc-bf16.safetensors" \
|
| 35 |
+
--learning_rate 1e-4 \
|
| 36 |
+
--num_epochs 5 \
|
| 37 |
+
--remove_prefix_in_ckpt "pipe.video_dit." \
|
| 38 |
+
--output_path "./models/train/MOVA-360p-I2AV_low_noise_lora" \
|
| 39 |
+
--lora_base_model "video_dit" \
|
| 40 |
+
--lora_target_modules "q,k,v,o,ffn.0,ffn.2" \
|
| 41 |
+
--lora_rank 32 \
|
| 42 |
+
--max_timestep_boundary 1 \
|
| 43 |
+
--min_timestep_boundary 0.358 \
|
| 44 |
+
--use_gradient_checkpointing
|
| 45 |
+
# boundary corresponds to timesteps [0, 900)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/lora/MOVA-720P-I2AV.sh
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modelscope download --dataset DiffSynth-Studio/diffsynth_example_dataset --include "mova/MOVA-720P-I2AV/*" --local_dir ./data/diffsynth_example_dataset
|
| 2 |
+
|
| 3 |
+
accelerate launch examples/mova/model_training/train.py \
|
| 4 |
+
--dataset_base_path data/diffsynth_example_dataset/mova/MOVA-720P-I2AV \
|
| 5 |
+
--dataset_metadata_path data/diffsynth_example_dataset/mova/MOVA-720P-I2AV/metadata.csv \
|
| 6 |
+
--data_file_keys "video,input_audio" \
|
| 7 |
+
--extra_inputs "input_audio,input_image" \
|
| 8 |
+
--height 720 \
|
| 9 |
+
--width 1280 \
|
| 10 |
+
--num_frames 121 \
|
| 11 |
+
--dataset_repeat 100 \
|
| 12 |
+
--model_id_with_origin_paths "openmoss/MOVA-720p:video_dit/diffusion_pytorch_model-*.safetensors,openmoss/MOVA-720p:audio_dit/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:dual_tower_bridge/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:audio_vae/diffusion_pytorch_model.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:Wan2.1_VAE.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:models_t5_umt5-xxl-enc-bf16.safetensors" \
|
| 13 |
+
--learning_rate 1e-4 \
|
| 14 |
+
--num_epochs 5 \
|
| 15 |
+
--remove_prefix_in_ckpt "pipe.video_dit." \
|
| 16 |
+
--output_path "./models/train/MOVA-720p-I2AV_high_noise_lora" \
|
| 17 |
+
--lora_base_model "video_dit" \
|
| 18 |
+
--lora_target_modules "q,k,v,o,ffn.0,ffn.2" \
|
| 19 |
+
--lora_rank 32 \
|
| 20 |
+
--max_timestep_boundary 0.358 \
|
| 21 |
+
--min_timestep_boundary 0 \
|
| 22 |
+
--use_gradient_checkpointing
|
| 23 |
+
# boundary corresponds to timesteps [900, 1000]
|
| 24 |
+
|
| 25 |
+
accelerate launch examples/mova/model_training/train.py \
|
| 26 |
+
--dataset_base_path data/diffsynth_example_dataset/mova/MOVA-720P-I2AV \
|
| 27 |
+
--dataset_metadata_path data/diffsynth_example_dataset/mova/MOVA-720P-I2AV/metadata.csv \
|
| 28 |
+
--data_file_keys "video,input_audio" \
|
| 29 |
+
--extra_inputs "input_audio,input_image" \
|
| 30 |
+
--height 720 \
|
| 31 |
+
--width 1280 \
|
| 32 |
+
--num_frames 121 \
|
| 33 |
+
--dataset_repeat 100 \
|
| 34 |
+
--model_id_with_origin_paths "openmoss/MOVA-720p:video_dit_2/diffusion_pytorch_model-*.safetensors,openmoss/MOVA-720p:audio_dit/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:dual_tower_bridge/diffusion_pytorch_model.safetensors,openmoss/MOVA-720p:audio_vae/diffusion_pytorch_model.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:Wan2.1_VAE.safetensors,DiffSynth-Studio/Wan-Series-Converted-Safetensors:models_t5_umt5-xxl-enc-bf16.safetensors" \
|
| 35 |
+
--learning_rate 1e-4 \
|
| 36 |
+
--num_epochs 5 \
|
| 37 |
+
--remove_prefix_in_ckpt "pipe.video_dit." \
|
| 38 |
+
--output_path "./models/train/MOVA-720p-I2AV_low_noise_lora" \
|
| 39 |
+
--lora_base_model "video_dit" \
|
| 40 |
+
--lora_target_modules "q,k,v,o,ffn.0,ffn.2" \
|
| 41 |
+
--lora_rank 32 \
|
| 42 |
+
--max_timestep_boundary 1 \
|
| 43 |
+
--min_timestep_boundary 0.358 \
|
| 44 |
+
--use_gradient_checkpointing
|
| 45 |
+
# boundary corresponds to timesteps [0, 900)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/train.py
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch, os, argparse, accelerate, warnings
|
| 2 |
+
from diffsynth.core import UnifiedDataset
|
| 3 |
+
from diffsynth.core.data.operators import LoadAudioWithTorchaudio, ToAbsolutePath, RouteByType, SequencialProcess
|
| 4 |
+
from diffsynth.pipelines.mova_audio_video import MovaAudioVideoPipeline, ModelConfig
|
| 5 |
+
from diffsynth.diffusion import *
|
| 6 |
+
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class MOVATrainingModule(DiffusionTrainingModule):
|
| 10 |
+
def __init__(
|
| 11 |
+
self,
|
| 12 |
+
model_paths=None, model_id_with_origin_paths=None,
|
| 13 |
+
tokenizer_path=None,
|
| 14 |
+
trainable_models=None,
|
| 15 |
+
lora_base_model=None, lora_target_modules="", lora_rank=32, lora_checkpoint=None,
|
| 16 |
+
preset_lora_path=None, preset_lora_model=None,
|
| 17 |
+
use_gradient_checkpointing=True,
|
| 18 |
+
use_gradient_checkpointing_offload=False,
|
| 19 |
+
extra_inputs=None,
|
| 20 |
+
fp8_models=None,
|
| 21 |
+
offload_models=None,
|
| 22 |
+
resume_from_checkpoint=None, remove_prefix_in_ckpt=None,
|
| 23 |
+
device="cpu",
|
| 24 |
+
task="sft",
|
| 25 |
+
max_timestep_boundary=1.0,
|
| 26 |
+
min_timestep_boundary=0.0,
|
| 27 |
+
):
|
| 28 |
+
super().__init__()
|
| 29 |
+
# Warning
|
| 30 |
+
if not use_gradient_checkpointing:
|
| 31 |
+
warnings.warn("Gradient checkpointing is detected as disabled. To prevent out-of-memory errors, the training framework will forcibly enable gradient checkpointing.")
|
| 32 |
+
use_gradient_checkpointing = True
|
| 33 |
+
|
| 34 |
+
# Load models
|
| 35 |
+
model_configs = self.parse_model_configs(model_paths, model_id_with_origin_paths, fp8_models=fp8_models, offload_models=offload_models, device=device)
|
| 36 |
+
tokenizer_config = ModelConfig(model_id="google/gemma-3-12b-it-qat-q4_0-unquantized") if tokenizer_path is None else ModelConfig(tokenizer_path)
|
| 37 |
+
self.pipe = MovaAudioVideoPipeline.from_pretrained(torch_dtype=torch.bfloat16, device=device, model_configs=model_configs, tokenizer_config=tokenizer_config)
|
| 38 |
+
self.pipe = self.split_pipeline_units(
|
| 39 |
+
task, self.pipe, trainable_models, lora_base_model,
|
| 40 |
+
remove_unnecessary_params=True,
|
| 41 |
+
force_remove_params_shared=("audio_latents", "video_latents"),
|
| 42 |
+
force_remove_params_nega=("audio_context", "video_context")
|
| 43 |
+
)
|
| 44 |
+
self.resume_from_checkpoint(resume_from_checkpoint, remove_prefix_in_ckpt)
|
| 45 |
+
# Training mode
|
| 46 |
+
self.switch_pipe_to_training_mode(
|
| 47 |
+
self.pipe, trainable_models,
|
| 48 |
+
lora_base_model, lora_target_modules, lora_rank, lora_checkpoint,
|
| 49 |
+
preset_lora_path, preset_lora_model,
|
| 50 |
+
task=task,
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
# Store other configs
|
| 54 |
+
self.use_gradient_checkpointing = use_gradient_checkpointing
|
| 55 |
+
self.use_gradient_checkpointing_offload = use_gradient_checkpointing_offload
|
| 56 |
+
self.extra_inputs = extra_inputs.split(",") if extra_inputs is not None else []
|
| 57 |
+
self.fp8_models = fp8_models
|
| 58 |
+
self.task = task
|
| 59 |
+
self.task_to_loss = {
|
| 60 |
+
"sft:data_process": lambda pipe, *args: args,
|
| 61 |
+
"sft": lambda pipe, inputs_shared, inputs_posi, inputs_nega: FlowMatchSFTAudioVideoLoss(pipe, **inputs_shared, **inputs_posi),
|
| 62 |
+
"sft:train": lambda pipe, inputs_shared, inputs_posi, inputs_nega: FlowMatchSFTAudioVideoLoss(pipe, **inputs_shared, **inputs_posi),
|
| 63 |
+
}
|
| 64 |
+
self.max_timestep_boundary = max_timestep_boundary
|
| 65 |
+
self.min_timestep_boundary = min_timestep_boundary
|
| 66 |
+
|
| 67 |
+
def parse_extra_inputs(self, data, extra_inputs, inputs_shared):
|
| 68 |
+
for extra_input in extra_inputs:
|
| 69 |
+
if extra_input == "input_image":
|
| 70 |
+
inputs_shared["input_image"] = data["video"][0]
|
| 71 |
+
else:
|
| 72 |
+
inputs_shared[extra_input] = data[extra_input]
|
| 73 |
+
return inputs_shared
|
| 74 |
+
|
| 75 |
+
def get_pipeline_inputs(self, data):
|
| 76 |
+
inputs_posi = {"prompt": data["prompt"]}
|
| 77 |
+
inputs_nega = {}
|
| 78 |
+
inputs_shared = {
|
| 79 |
+
# Assume you are using this pipeline for inference,
|
| 80 |
+
# please fill in the input parameters.
|
| 81 |
+
"input_video": data["video"],
|
| 82 |
+
"height": data["video"][0].size[1],
|
| 83 |
+
"width": data["video"][0].size[0],
|
| 84 |
+
"num_frames": len(data["video"]),
|
| 85 |
+
"frame_rate": data.get("frame_rate", 24),
|
| 86 |
+
# Please do not modify the following parameters
|
| 87 |
+
# unless you clearly know what this will cause.
|
| 88 |
+
"cfg_scale": 1,
|
| 89 |
+
"tiled": False,
|
| 90 |
+
"rand_device": self.pipe.device,
|
| 91 |
+
"use_gradient_checkpointing": self.use_gradient_checkpointing,
|
| 92 |
+
"use_gradient_checkpointing_offload": self.use_gradient_checkpointing_offload,
|
| 93 |
+
"max_timestep_boundary": self.max_timestep_boundary,
|
| 94 |
+
"min_timestep_boundary": self.min_timestep_boundary,
|
| 95 |
+
}
|
| 96 |
+
inputs_shared = self.parse_extra_inputs(data, self.extra_inputs, inputs_shared)
|
| 97 |
+
return inputs_shared, inputs_posi, inputs_nega
|
| 98 |
+
|
| 99 |
+
def forward(self, data, inputs=None):
|
| 100 |
+
if inputs is None: inputs = self.get_pipeline_inputs(data)
|
| 101 |
+
inputs = self.transfer_data_to_device(inputs, self.pipe.device, self.pipe.torch_dtype)
|
| 102 |
+
for unit in self.pipe.units:
|
| 103 |
+
inputs = self.pipe.unit_runner(unit, self.pipe, *inputs)
|
| 104 |
+
loss = self.task_to_loss[self.task](self.pipe, *inputs)
|
| 105 |
+
return loss
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def ltx2_parser():
|
| 109 |
+
parser = argparse.ArgumentParser(description="Simple example of a training script.")
|
| 110 |
+
parser = add_general_config(parser)
|
| 111 |
+
parser = add_video_size_config(parser)
|
| 112 |
+
parser.add_argument("--tokenizer_path", type=str, default=None, help="Path to tokenizer.")
|
| 113 |
+
parser.add_argument("--frame_rate", type=float, default=24, help="Frame rate of the training videos. Mova is trained with a frame rate of 24, so it's recommended to use the same frame rate.")
|
| 114 |
+
parser.add_argument("--max_timestep_boundary", type=float, default=1.0, help="Max timestep boundary (for mixed models, e.g., Wan-AI/Wan2.2-I2V-A14B).")
|
| 115 |
+
parser.add_argument("--min_timestep_boundary", type=float, default=0.0, help="Min timestep boundary (for mixed models, e.g., Wan-AI/Wan2.2-I2V-A14B).")
|
| 116 |
+
parser.add_argument("--initialize_model_on_cpu", default=False, action="store_true", help="Whether to initialize models on CPU.")
|
| 117 |
+
return parser
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
if __name__ == "__main__":
|
| 121 |
+
parser = ltx2_parser()
|
| 122 |
+
args = parser.parse_args()
|
| 123 |
+
accelerator = accelerate.Accelerator(
|
| 124 |
+
gradient_accumulation_steps=args.gradient_accumulation_steps,
|
| 125 |
+
kwargs_handlers=[accelerate.DistributedDataParallelKwargs(find_unused_parameters=args.find_unused_parameters)],
|
| 126 |
+
)
|
| 127 |
+
model = MOVATrainingModule(
|
| 128 |
+
model_paths=args.model_paths,
|
| 129 |
+
model_id_with_origin_paths=args.model_id_with_origin_paths,
|
| 130 |
+
tokenizer_path=args.tokenizer_path,
|
| 131 |
+
trainable_models=args.trainable_models,
|
| 132 |
+
lora_base_model=args.lora_base_model,
|
| 133 |
+
lora_target_modules=args.lora_target_modules,
|
| 134 |
+
lora_rank=args.lora_rank,
|
| 135 |
+
lora_checkpoint=args.lora_checkpoint,
|
| 136 |
+
preset_lora_path=args.preset_lora_path,
|
| 137 |
+
preset_lora_model=args.preset_lora_model,
|
| 138 |
+
use_gradient_checkpointing=args.use_gradient_checkpointing,
|
| 139 |
+
use_gradient_checkpointing_offload=args.use_gradient_checkpointing_offload,
|
| 140 |
+
extra_inputs=args.extra_inputs,
|
| 141 |
+
fp8_models=args.fp8_models,
|
| 142 |
+
offload_models=args.offload_models,
|
| 143 |
+
resume_from_checkpoint=args.resume_from_checkpoint,
|
| 144 |
+
remove_prefix_in_ckpt=args.remove_prefix_in_ckpt,
|
| 145 |
+
task=args.task,
|
| 146 |
+
device="cpu" if (args.initialize_model_on_cpu or args.enable_model_cpu_offload) else accelerator.device,
|
| 147 |
+
max_timestep_boundary=args.max_timestep_boundary,
|
| 148 |
+
min_timestep_boundary=args.min_timestep_boundary,
|
| 149 |
+
)
|
| 150 |
+
video_processor = UnifiedDataset.default_video_operator(
|
| 151 |
+
base_path=args.dataset_base_path,
|
| 152 |
+
max_pixels=args.max_pixels,
|
| 153 |
+
height=args.height,
|
| 154 |
+
width=args.width,
|
| 155 |
+
height_division_factor=16,
|
| 156 |
+
width_division_factor=16,
|
| 157 |
+
num_frames=args.num_frames,
|
| 158 |
+
time_division_factor=4,
|
| 159 |
+
time_division_remainder=1,
|
| 160 |
+
frame_rate=args.frame_rate,
|
| 161 |
+
fix_frame_rate=True,
|
| 162 |
+
)
|
| 163 |
+
dataset = UnifiedDataset(
|
| 164 |
+
base_path=args.dataset_base_path,
|
| 165 |
+
metadata_path=args.dataset_metadata_path,
|
| 166 |
+
repeat=args.dataset_repeat,
|
| 167 |
+
data_file_keys=args.data_file_keys.split(","),
|
| 168 |
+
main_data_operator=video_processor,
|
| 169 |
+
special_operator_map={
|
| 170 |
+
"input_audio":
|
| 171 |
+
ToAbsolutePath(args.dataset_base_path) >> LoadAudioWithTorchaudio(
|
| 172 |
+
num_frames=args.num_frames,
|
| 173 |
+
time_division_factor=4,
|
| 174 |
+
time_division_remainder=1,
|
| 175 |
+
frame_rate=args.frame_rate,
|
| 176 |
+
),
|
| 177 |
+
"in_context_videos":
|
| 178 |
+
RouteByType(operator_map=[
|
| 179 |
+
(str, video_processor),
|
| 180 |
+
(list, SequencialProcess(video_processor)),
|
| 181 |
+
]),
|
| 182 |
+
},
|
| 183 |
+
)
|
| 184 |
+
|
| 185 |
+
model_logger = ModelLogger(
|
| 186 |
+
args.output_path,
|
| 187 |
+
remove_prefix_in_ckpt=args.remove_prefix_in_ckpt,
|
| 188 |
+
enable_tensorboard_log=args.enable_tensorboard_log,
|
| 189 |
+
enable_swanlab_log=args.enable_swanlab_log,
|
| 190 |
+
swanlab_project=args.swanlab_project,
|
| 191 |
+
enable_wandb_log=args.enable_wandb_log,
|
| 192 |
+
wandb_project=args.wandb_project,
|
| 193 |
+
)
|
| 194 |
+
launcher_map = {
|
| 195 |
+
"sft:data_process": launch_data_process_task,
|
| 196 |
+
"direct_distill:data_process": launch_data_process_task,
|
| 197 |
+
"sft": launch_training_task,
|
| 198 |
+
"sft:train": launch_training_task,
|
| 199 |
+
"direct_distill": launch_training_task,
|
| 200 |
+
"direct_distill:train": launch_training_task,
|
| 201 |
+
}
|
| 202 |
+
launcher_map[args.task](accelerator, dataset, model, model_logger, args=args)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/validate_full/MOVA-360p-I2AV.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from PIL import Image
|
| 3 |
+
from diffsynth.pipelines.mova_audio_video import ModelConfig, MovaAudioVideoPipeline
|
| 4 |
+
from diffsynth.utils.data.audio_video import write_video_audio
|
| 5 |
+
from diffsynth.utils.data import VideoData
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
vram_config = {
|
| 9 |
+
"offload_dtype": torch.bfloat16,
|
| 10 |
+
"offload_device": "cpu",
|
| 11 |
+
"onload_dtype": torch.bfloat16,
|
| 12 |
+
"onload_device": "cuda",
|
| 13 |
+
"preparing_dtype": torch.bfloat16,
|
| 14 |
+
"preparing_device": "cuda",
|
| 15 |
+
"computation_dtype": torch.bfloat16,
|
| 16 |
+
"computation_device": "cuda",
|
| 17 |
+
}
|
| 18 |
+
pipe = MovaAudioVideoPipeline.from_pretrained(
|
| 19 |
+
torch_dtype=torch.bfloat16,
|
| 20 |
+
device="cuda",
|
| 21 |
+
model_configs=[
|
| 22 |
+
ModelConfig(path="./models/train/MOVA-360p-I2AV_high_noise_full/epoch-4.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="video_dit_2/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="audio_dit/diffusion_pytorch_model.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="dual_tower_bridge/diffusion_pytorch_model.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_vae/diffusion_pytorch_model.safetensors", **vram_config),
|
| 27 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="Wan2.1_VAE.safetensors", **vram_config),
|
| 28 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="models_t5_umt5-xxl-enc-bf16.safetensors", **vram_config),
|
| 29 |
+
],
|
| 30 |
+
tokenizer_config=ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="tokenizer/"),
|
| 31 |
+
)
|
| 32 |
+
negative_prompt = (
|
| 33 |
+
"色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,"
|
| 34 |
+
"整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指"
|
| 35 |
+
)
|
| 36 |
+
prompt = "A beautiful sunset over the ocean."
|
| 37 |
+
height, width, num_frames = 352, 640, 121
|
| 38 |
+
frame_rate = 24
|
| 39 |
+
input_image = VideoData("data/example_video_dataset/ltx2/video.mp4", height=height, width=width)[0]
|
| 40 |
+
# Image-to-video
|
| 41 |
+
video, audio = pipe(
|
| 42 |
+
prompt=prompt,
|
| 43 |
+
negative_prompt=negative_prompt,
|
| 44 |
+
height=height,
|
| 45 |
+
width=width,
|
| 46 |
+
num_frames=num_frames,
|
| 47 |
+
input_image=input_image,
|
| 48 |
+
num_inference_steps=50,
|
| 49 |
+
seed=0,
|
| 50 |
+
tiled=True,
|
| 51 |
+
frame_rate=frame_rate,
|
| 52 |
+
)
|
| 53 |
+
write_video_audio(video, audio, "MOVA-360p.mp4", fps=24, audio_sample_rate=pipe.audio_vae.sample_rate)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/validate_full/MOVA-720p-I2AV.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from PIL import Image
|
| 3 |
+
from diffsynth.utils.data.audio_video import write_video_audio
|
| 4 |
+
from diffsynth.pipelines.mova_audio_video import MovaAudioVideoPipeline, ModelConfig
|
| 5 |
+
from diffsynth.utils.data import VideoData
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
vram_config = {
|
| 9 |
+
"offload_dtype": torch.bfloat16,
|
| 10 |
+
"offload_device": "cpu",
|
| 11 |
+
"onload_dtype": torch.bfloat16,
|
| 12 |
+
"onload_device": "cuda",
|
| 13 |
+
"preparing_dtype": torch.bfloat16,
|
| 14 |
+
"preparing_device": "cuda",
|
| 15 |
+
"computation_dtype": torch.bfloat16,
|
| 16 |
+
"computation_device": "cuda",
|
| 17 |
+
}
|
| 18 |
+
pipe = MovaAudioVideoPipeline.from_pretrained(
|
| 19 |
+
torch_dtype=torch.bfloat16,
|
| 20 |
+
device="cuda",
|
| 21 |
+
model_configs=[
|
| 22 |
+
ModelConfig(path="./models/train/MOVA-720p-I2AV_high_noise_full/epoch-4.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="video_dit_2/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_dit/diffusion_pytorch_model.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="dual_tower_bridge/diffusion_pytorch_model.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_vae/diffusion_pytorch_model.safetensors", **vram_config),
|
| 27 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="Wan2.1_VAE.safetensors", **vram_config),
|
| 28 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="models_t5_umt5-xxl-enc-bf16.safetensors", **vram_config),
|
| 29 |
+
],
|
| 30 |
+
tokenizer_config=ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="tokenizer/"),
|
| 31 |
+
)
|
| 32 |
+
pipe.load_lora(pipe.video_dit, "models/train/MOVA-720p-I2AV_high_noise_lora/epoch-4.safetensors")
|
| 33 |
+
negative_prompt = (
|
| 34 |
+
"色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,"
|
| 35 |
+
"整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指"
|
| 36 |
+
)
|
| 37 |
+
prompt = "A beautiful sunset over the ocean."
|
| 38 |
+
height, width, num_frames = 720, 1280, 121
|
| 39 |
+
frame_rate = 24
|
| 40 |
+
input_image = VideoData("data/example_video_dataset/ltx2/video.mp4", height=height, width=width)[0]
|
| 41 |
+
# Image-to-video
|
| 42 |
+
video, audio = pipe(
|
| 43 |
+
prompt=prompt,
|
| 44 |
+
negative_prompt=negative_prompt,
|
| 45 |
+
height=height,
|
| 46 |
+
width=width,
|
| 47 |
+
num_frames=num_frames,
|
| 48 |
+
input_image=input_image,
|
| 49 |
+
num_inference_steps=50,
|
| 50 |
+
seed=0,
|
| 51 |
+
tiled=True,
|
| 52 |
+
frame_rate=frame_rate,
|
| 53 |
+
)
|
| 54 |
+
write_video_audio(video, audio, "MOVA-720p.mp4", fps=24, audio_sample_rate=pipe.audio_vae.sample_rate)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/validate_lora/MOVA-360p-I2AV.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from PIL import Image
|
| 3 |
+
from diffsynth.pipelines.mova_audio_video import ModelConfig, MovaAudioVideoPipeline
|
| 4 |
+
from diffsynth.utils.data.audio_video import write_video_audio
|
| 5 |
+
from diffsynth.utils.data import VideoData
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
vram_config = {
|
| 9 |
+
"offload_dtype": torch.bfloat16,
|
| 10 |
+
"offload_device": "cpu",
|
| 11 |
+
"onload_dtype": torch.bfloat16,
|
| 12 |
+
"onload_device": "cuda",
|
| 13 |
+
"preparing_dtype": torch.bfloat16,
|
| 14 |
+
"preparing_device": "cuda",
|
| 15 |
+
"computation_dtype": torch.bfloat16,
|
| 16 |
+
"computation_device": "cuda",
|
| 17 |
+
}
|
| 18 |
+
pipe = MovaAudioVideoPipeline.from_pretrained(
|
| 19 |
+
torch_dtype=torch.bfloat16,
|
| 20 |
+
device="cuda",
|
| 21 |
+
model_configs=[
|
| 22 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="video_dit/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="video_dit_2/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="audio_dit/diffusion_pytorch_model.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="openmoss/MOVA-360p", origin_file_pattern="dual_tower_bridge/diffusion_pytorch_model.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_vae/diffusion_pytorch_model.safetensors", **vram_config),
|
| 27 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="Wan2.1_VAE.safetensors", **vram_config),
|
| 28 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="models_t5_umt5-xxl-enc-bf16.safetensors", **vram_config),
|
| 29 |
+
],
|
| 30 |
+
tokenizer_config=ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="tokenizer/"),
|
| 31 |
+
)
|
| 32 |
+
pipe.load_lora(pipe.video_dit, "models/train/MOVA-360p-I2AV_high_noise_lora/epoch-4.safetensors")
|
| 33 |
+
negative_prompt = (
|
| 34 |
+
"色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,"
|
| 35 |
+
"整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指"
|
| 36 |
+
)
|
| 37 |
+
prompt = "A beautiful sunset over the ocean."
|
| 38 |
+
height, width, num_frames = 352, 640, 121
|
| 39 |
+
frame_rate = 24
|
| 40 |
+
input_image = VideoData("data/example_video_dataset/ltx2/video.mp4", height=height, width=width)[0]
|
| 41 |
+
# Image-to-video
|
| 42 |
+
video, audio = pipe(
|
| 43 |
+
prompt=prompt,
|
| 44 |
+
negative_prompt=negative_prompt,
|
| 45 |
+
height=height,
|
| 46 |
+
width=width,
|
| 47 |
+
num_frames=num_frames,
|
| 48 |
+
input_image=input_image,
|
| 49 |
+
num_inference_steps=50,
|
| 50 |
+
seed=0,
|
| 51 |
+
tiled=True,
|
| 52 |
+
frame_rate=frame_rate,
|
| 53 |
+
)
|
| 54 |
+
write_video_audio(video, audio, "MOVA-360p.mp4", fps=24, audio_sample_rate=pipe.audio_vae.sample_rate)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/mova/model_training/validate_lora/MOVA-720p-I2AV.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from PIL import Image
|
| 3 |
+
from diffsynth.utils.data.audio_video import write_video_audio
|
| 4 |
+
from diffsynth.pipelines.mova_audio_video import MovaAudioVideoPipeline, ModelConfig
|
| 5 |
+
from diffsynth.utils.data import VideoData
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
vram_config = {
|
| 9 |
+
"offload_dtype": torch.bfloat16,
|
| 10 |
+
"offload_device": "cpu",
|
| 11 |
+
"onload_dtype": torch.bfloat16,
|
| 12 |
+
"onload_device": "cuda",
|
| 13 |
+
"preparing_dtype": torch.bfloat16,
|
| 14 |
+
"preparing_device": "cuda",
|
| 15 |
+
"computation_dtype": torch.bfloat16,
|
| 16 |
+
"computation_device": "cuda",
|
| 17 |
+
}
|
| 18 |
+
pipe = MovaAudioVideoPipeline.from_pretrained(
|
| 19 |
+
torch_dtype=torch.bfloat16,
|
| 20 |
+
device="cuda",
|
| 21 |
+
model_configs=[
|
| 22 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="video_dit/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 23 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="video_dit_2/diffusion_pytorch_model-*.safetensors", **vram_config),
|
| 24 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_dit/diffusion_pytorch_model.safetensors", **vram_config),
|
| 25 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="dual_tower_bridge/diffusion_pytorch_model.safetensors", **vram_config),
|
| 26 |
+
ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="audio_vae/diffusion_pytorch_model.safetensors", **vram_config),
|
| 27 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="Wan2.1_VAE.safetensors", **vram_config),
|
| 28 |
+
ModelConfig(model_id="DiffSynth-Studio/Wan-Series-Converted-Safetensors", origin_file_pattern="models_t5_umt5-xxl-enc-bf16.safetensors", **vram_config),
|
| 29 |
+
],
|
| 30 |
+
tokenizer_config=ModelConfig(model_id="openmoss/MOVA-720p", origin_file_pattern="tokenizer/"),
|
| 31 |
+
)
|
| 32 |
+
pipe.load_lora(pipe.video_dit, "models/train/MOVA-720p-I2AV_high_noise_lora/epoch-4.safetensors")
|
| 33 |
+
negative_prompt = (
|
| 34 |
+
"色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,"
|
| 35 |
+
"整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指"
|
| 36 |
+
)
|
| 37 |
+
prompt = "A beautiful sunset over the ocean."
|
| 38 |
+
height, width, num_frames = 720, 1280, 121
|
| 39 |
+
frame_rate = 24
|
| 40 |
+
input_image = VideoData("data/example_video_dataset/ltx2/video.mp4", height=height, width=width)[0]
|
| 41 |
+
# Image-to-video
|
| 42 |
+
video, audio = pipe(
|
| 43 |
+
prompt=prompt,
|
| 44 |
+
negative_prompt=negative_prompt,
|
| 45 |
+
height=height,
|
| 46 |
+
width=width,
|
| 47 |
+
num_frames=num_frames,
|
| 48 |
+
input_image=input_image,
|
| 49 |
+
num_inference_steps=50,
|
| 50 |
+
seed=0,
|
| 51 |
+
tiled=True,
|
| 52 |
+
frame_rate=frame_rate,
|
| 53 |
+
)
|
| 54 |
+
write_video_audio(video, audio, "MOVA-720p.mp4", fps=24, audio_sample_rate=pipe.audio_vae.sample_rate)
|
video_gen_14d/third_party/DiffSynth-Studio/examples/qwen_image/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
English Document: https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Qwen-Image.html
|
| 2 |
+
|
| 3 |
+
中文文档:https://diffsynth-studio-doc.readthedocs.io/zh-cn/latest/Model_Details/Qwen-Image.html
|
video_gen_14d/third_party/DiffSynth-Studio/examples/qwen_image/model_inference/FireRed-Image-Edit-1.0.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig
|
| 2 |
+
from modelscope import dataset_snapshot_download
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import torch
|
| 5 |
+
|
| 6 |
+
pipe = QwenImagePipeline.from_pretrained(
|
| 7 |
+
torch_dtype=torch.bfloat16,
|
| 8 |
+
device="cuda",
|
| 9 |
+
model_configs=[
|
| 10 |
+
ModelConfig(model_id="FireRedTeam/FireRed-Image-Edit-1.0", origin_file_pattern="transformer/diffusion_pytorch_model*.safetensors"),
|
| 11 |
+
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors"),
|
| 12 |
+
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors"),
|
| 13 |
+
],
|
| 14 |
+
processor_config=ModelConfig(model_id="Qwen/Qwen-Image-Edit", origin_file_pattern="processor/"),
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
dataset_snapshot_download(
|
| 18 |
+
"DiffSynth-Studio/example_image_dataset",
|
| 19 |
+
allow_file_pattern="qwen_image_edit/*",
|
| 20 |
+
local_dir="data/example_image_dataset",
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
prompt = "生成这两个人的合影"
|
| 24 |
+
edit_image = [
|
| 25 |
+
Image.open("data/example_image_dataset/qwen_image_edit/image1.jpg"),
|
| 26 |
+
Image.open("data/example_image_dataset/qwen_image_edit/image2.jpg"),
|
| 27 |
+
]
|
| 28 |
+
image = pipe(
|
| 29 |
+
prompt,
|
| 30 |
+
edit_image=edit_image,
|
| 31 |
+
seed=1,
|
| 32 |
+
num_inference_steps=40,
|
| 33 |
+
height=1152,
|
| 34 |
+
width=896,
|
| 35 |
+
edit_image_auto_resize=True,
|
| 36 |
+
)
|
| 37 |
+
image.save("image.jpg")
|
| 38 |
+
|
| 39 |
+
# FireRedTeam/FireRed-Image-Edit-1.0 is a multi-image editing model.
|
| 40 |
+
# Please use a list to input `edit_image`, even if the input contains only one image.
|
| 41 |
+
# edit_image = [Image.open("image.jpg")]
|
| 42 |
+
# Please do not input the image directly.
|
| 43 |
+
# edit_image = Image.open("image.jpg")
|
video_gen_14d/third_party/DiffSynth-Studio/examples/qwen_image/model_inference/FireRed-Image-Edit-1.1.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from diffsynth.pipelines.qwen_image import QwenImagePipeline, ModelConfig
|
| 2 |
+
from modelscope import dataset_snapshot_download
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import torch
|
| 5 |
+
|
| 6 |
+
pipe = QwenImagePipeline.from_pretrained(
|
| 7 |
+
torch_dtype=torch.bfloat16,
|
| 8 |
+
device="cuda",
|
| 9 |
+
model_configs=[
|
| 10 |
+
ModelConfig(model_id="FireRedTeam/FireRed-Image-Edit-1.1", origin_file_pattern="transformer/diffusion_pytorch_model*.safetensors"),
|
| 11 |
+
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="text_encoder/model*.safetensors"),
|
| 12 |
+
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors"),
|
| 13 |
+
],
|
| 14 |
+
processor_config=ModelConfig(model_id="Qwen/Qwen-Image-Edit", origin_file_pattern="processor/"),
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
dataset_snapshot_download(
|
| 18 |
+
"DiffSynth-Studio/example_image_dataset",
|
| 19 |
+
allow_file_pattern="qwen_image_edit/*",
|
| 20 |
+
local_dir="data/example_image_dataset",
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
prompt = "生成这两个人的合影"
|
| 24 |
+
edit_image = [
|
| 25 |
+
Image.open("data/example_image_dataset/qwen_image_edit/image1.jpg"),
|
| 26 |
+
Image.open("data/example_image_dataset/qwen_image_edit/image2.jpg"),
|
| 27 |
+
]
|
| 28 |
+
image = pipe(
|
| 29 |
+
prompt,
|
| 30 |
+
edit_image=edit_image,
|
| 31 |
+
seed=1,
|
| 32 |
+
num_inference_steps=40,
|
| 33 |
+
height=1152,
|
| 34 |
+
width=896,
|
| 35 |
+
edit_image_auto_resize=True,
|
| 36 |
+
)
|
| 37 |
+
image.save("image.jpg")
|
| 38 |
+
|
| 39 |
+
# FireRedTeam/FireRed-Image-Edit-1.1 is a multi-image editing model.
|
| 40 |
+
# Please use a list to input `edit_image`, even if the input contains only one image.
|
| 41 |
+
# edit_image = [Image.open("image.jpg")]
|
| 42 |
+
# Please do not input the image directly.
|
| 43 |
+
# edit_image = Image.open("image.jpg")
|