Download examples/lingbot_video/model_training/special/split_training/validate.py from ymyy307/diffsynth: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/ymyy307/diffsynth/resolve/main/examples/lingbot_video/model_training/special/split_training/validate.py
- Command line
-
hf download hf://ymyy307/diffsynth/examples/lingbot_video/model_training/special/split_training/validate.py
-
curl -L -o validate.py https://huggingface.co/ymyy307/diffsynth/resolve/main/examples/lingbot_video/model_training/special/split_training/validate.py
1.54 kB
| import torch | |
| import json | |
| from diffsynth.utils.data import save_video | |
| from diffsynth.pipelines.lingbot_video import LingBotVideoPipeline, ModelConfig | |
| from modelscope import dataset_snapshot_download | |
| pipe = LingBotVideoPipeline.from_pretrained( | |
| torch_dtype=torch.bfloat16, | |
| device="cuda", | |
| model_configs=[ | |
| ModelConfig(model_id="Robbyant/lingbot-video-dense-1.3b", origin_file_pattern="transformer/diffusion_pytorch_model.safetensors"), | |
| ModelConfig(model_id="Qwen/Qwen3-VL-4B-Instruct", origin_file_pattern="*.safetensors"), | |
| ModelConfig(model_id="Robbyant/lingbot-video-dense-1.3b", origin_file_pattern="vae/diffusion_pytorch_model.safetensors"), | |
| ], | |
| processor_config=ModelConfig(model_id="Qwen/Qwen3-VL-4B-Instruct", origin_file_pattern=""), | |
| ) | |
| pipe.load_lora(pipe.dit, './models/train/lingbot-video-dense-1.3b_t2v_split/epoch-4.safetensors', alpha=1) | |
| dataset_snapshot_download( | |
| dataset_id="DiffSynth-Studio/diffsynth_example_dataset", | |
| local_dir="data/diffsynth_example_dataset", | |
| allow_file_pattern="lingbot_video/lingbot-video-dense-1.3b_t2v/*", | |
| ) | |
| with open("data/diffsynth_example_dataset/lingbot_video/lingbot-video-dense-1.3b_t2v/t2v_example_1.json", "r", encoding="utf-8") as f: | |
| caption = json.load(f) | |
| video = pipe( | |
| prompt=caption, | |
| negative_prompt=pipe.default_negative_prompt, | |
| height=480, width=832, num_frames=81, | |
| num_inference_steps=40, cfg_scale=3.0, | |
| seed=0, | |
| ) | |
| save_video(video, 'split_training_lingbot-video-dense-1.3b_t2v.mp4', fps=15, quality=10) | |