
一个库在Apple Silicon上原生跑LTX-2.3和Wan2.2两大视频模型,纯MLX加速,CLI一行出片,比PyTorch MPS快1.7倍
mlx-video — Mac原生MLX视频生成推理库
一个库在 Apple Silicon Mac 上原生跑 LTX-2.3 和 Wan2.2 两大视频生成模型,基于 MLX 框架,无需 ComfyUI,无需 CUDA,纯 Metal 加速。
核心亮点
- 双模型支持:LTX-2.3(音视频一体)+ Wan2.2(MoE图/文生视频),一个库全搞定
- 原生 MLX:专为 Apple Silicon 优化,利用统一内存,无 CPU-GPU 传输开销
- CLI 一行出片:不用搭工作流,命令行直接生成视频
- LoRA 加速:支持 Wan2.2-Lightning 4步极速生成
- MIT 开源
支持功能一览
| 功能 | LTX-2.3 | Wan2.2 |
|---|---|---|
| 文生视频 (T2V) | ✅ | ✅ |
| 图生视频 (I2V) | ✅ | ✅ |
| 音视频同步生成 | ✅ | — |
| 音频驱动视频 (A2V) | ✅ | — |
| LoRA 加速 | ✅ | ✅ 4步出片 |
| 空间超分 (2x) | ✅ | — |
安装
pip install git+https://github.com/Blaizzy/mlx-video.git
需要 macOS Apple Silicon + Python 3.11+ + MLX 0.22.0+
快速上手
LTX-2.3 文生视频(蒸馏版最快):
python -m mlx_video.ltx_2.generate \
--prompt "Two dogs wearing sunglasses, cinematic, sunset" \
-n 97 --width 768
LTX-2.3 图生视频:
python -m mlx_video.ltx_2.generate \
--prompt "A person dancing" \
--image photo.jpg
LTX-2.3 音视频同步生成:
python -m mlx_video.ltx_2.generate \
--audio-file music.wav \
--prompt "A band playing music"
Wan2.2 图生视频 (I2V-14B MoE):
python -m mlx_video.wan_2.generate \
--model-dir wan22_i2v_mlx \
--prompt "The camera slowly zooms in as the subject begins to move" \
--image start.png \
--num-frames 81 \
--output-path my_video.mp4
Wan2.2 + Lightning LoRA 4步极速生成:
python -m mlx_video.wan_2.generate \
--model-dir wan22_mlx \
--prompt "Ocean waves at sunset, cinematic" \
--steps 4 --guide-scale 1 \
--lora-high .../high_noise_model.safetensors 1 \
--lora-low .../low_noise_model.safetensors 1
性能参考(M4 Max 128GB)
LTX-2.3 FP16 实测数据:
| 配置 | 分辨率 | 帧数 | 耗时 | 峰值内存 |
|---|---|---|---|---|
| 纯视频 | 576×1024 | 121帧(5s) | 152s | 34GB |
| 视频+音频 | 576×1024 | 121帧(5s) | 206s | 47GB |
| 纯视频 | 512×512 | 49帧(2s) | 35s | 34GB |
| 纯视频 | 320×512 | 25帧(1s) | 10s | 31GB |
比 PyTorch MPS 快 1.7 倍,内存少 42%。
MLX 预转换权重
| 模型 | HuggingFace |
|---|---|
| LTX-2.3 distilled FP16 | gajesh/LTX-2.3-mlx-fp16 |
| LTX-2.3 distilled Q4 | gajesh/LTX-2.3-mlx-q4 |
| LTX-2.3 distilled/int4/int8 | dgrauet/ltx-2.3-mlx-q4 |
| Wan2.2 I2V BF16 | SceneWorks/wan2.2-i2v-a14b-mlx |
mlx-video 也支持从原始权重自动转换,参考 Wan 模型转换文档。
适合谁
- Apple Silicon Mac 用户(M1~M4 Ultra)
- 想本地跑视频生成但不想装 ComfyUI 的开发者
- 需要通过 Python API 集成到自定义工作流的团队
- 有 64GB+ 内存的 Mac 工作站(推荐 128GB+ 跑 FP16)
相关链接
- GitHub:Blaizzy/mlx-video
- LTX-2.3 模型:Lightricks/LTX-2.3
- Wan2.2 I2V 模型:Wan-AI/Wan2.2-I2V-A14B
暂无评论
