HadiZayer/masked-visual-actions

GitHub: HadiZayer/masked-visual-actions

基于 Wan2.2 视频模型训练 LoRA 的机器人视觉控制视频生成工具,支持自定义数据微调与推理。

Stars: 22 | Forks: 0

# masked-visual-actions 用于微调和运行我们的机器人视频**控制模型**的代码:一个基于 [`PAI/Wan2.2-Fun-A14B-Control`](https://modelscope.cn/models/PAI/Wan2.2-Fun-A14B-Control)的 LoRA。 给定一个**控制视频**(渲染的 URDF 机器人)、一张**参考图像**( 第一帧真实画面)以及一个**文本提示**,它会生成相应的 RGB 视频。 我们没有修改视频模型或其训练器——我们使用 [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio) 在我们的数据上 训练了一个 LoRA 并进行推理。本仓库是建立在其之上的轻量层:包含 推理脚本、训练方案以及我们的权重。 ``` inference/ infer.py, download_weights.py — run the model with our LoRAs training/ train_control.sh — finetune a control LoRA on your CSV ``` 权重位于 Hugging Face Hub 的 [`HadiZayer/masked-visual-actions`](https://huggingface.co/HadiZayer/masked-visual-actions)。 ## 环境设置 请在指定的 commit 安装 DiffSynth-Studio,然后安装本仓库的轻量级依赖: ``` git clone https://github.com/modelscope/DiffSynth-Studio.git cd DiffSynth-Studio git checkout 3743b1307caf2562af60d475b22d4b6be68e7cd0 pip install -e . pip install huggingface_hub ``` 需要 CUDA GPU(基础模型为 14B;如果你受到内存限制,`infer.py --low-vram` 会将其卸载到 磁盘)。 ## 推理 ``` python inference/download_weights.py --out ./checkpoints python inference/infer.py \ --lora-high checkpoints/masked_world_lora_high.safetensors \ --lora-low checkpoints/masked_world_lora_low.safetensors \ --control-video robot_render.mp4 \ --reference-image first_frame.png \ --prompt "a robot arm picks up a mug" \ --output out.mp4 ``` `Wan2.2-Fun-A14B-Control` 是一个双专家 MoE(包含一个 **high-noise** 和一个 **low-noise** DiT,在时间步边界 0.358 处分割),因此有两个 LoRA —— 一个加载到 `pipe.dit` 中,另一个加载到 `pipe.dit2` 中。`--reference-image` 是可选的(默认为 控制视频的第 0 帧)。有关分辨率/随机种子/步数的信息,请参见 `infer.py --help`。 ## 训练 提供一个包含 `prompt, reference_image, video, control_video` 列的 CSV,并运行 双专家方案(使用 DiffSynth 的默认参数,在 DiffSynth-Studio 根目录下运行): ``` cd DiffSynth-Studio DATASET_CSV=/path/to/train.csv OUTPUT_DIR=/path/to/out \ bash /path/to/masked-visual-actions/training/train_control.sh ``` 这将生成 `_high_noise/` 和 `_low_noise/`;请将 `infer.py` 指向你所需要的 `step-*.safetensors` 检查点。 ## 渲染控制视频 用于从 DROID episode 中渲染 URDF 机器人控制视频的工具即将 推出。 ## License Apache-2.0(继承自 DiffSynth-Studio)。请参阅 `LICENSE`。
标签:AI模型, DiffSynth-Studio, LoRA, Vectored Exception Handling, 凭据扫描, 机器人学, 机器视觉, 模型微调, 视频生成, 逆向工具