Image-Text-to-Video
MiniMax H3
English
lora
video-generation
reference-to-video
token-pruning
distillation
Instructions to use HikariDawn/CodecOPSD-H3-Ref2VA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Inference
- Notebooks
- Google Colab
- Kaggle
|
Download README.md from HikariDawn/CodecOPSD-H3-Ref2VA: direct link, hf CLI and curl.
- Browser
- Download file 12.4 kB
-
https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/README.md
- Command line
-
hf download hf://HikariDawn/CodecOPSD-H3-Ref2VA/README.md
-
curl -L -o README.md https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/README.md
12.4 kB
| license: other | |
| license_name: minimax-h3-community-license-agreement | |
| license_link: LICENSE | |
| base_model: MiniMaxAI/MiniMax-H3 | |
| base_model_relation: adapter | |
| pipeline_tag: image-text-to-video | |
| language: | |
| - en | |
| tags: | |
| - lora | |
| - video-generation | |
| - reference-to-video | |
| - token-pruning | |
| - distillation | |
| - minimax-h3 | |
| <div align="center"> | |
| <img width="100%" src="assets/codecopsd_header.gif" alt="CodecOPSD"> | |
| </div> | |
| <p align="center"> | |
| <a href="https://github.com/Kiteretsu77/CodecOPSD" target="_blank"><img src="https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white" alt="GitHub"></a> | |
| <a href="https://kiteretsu77.github.io/CodecOPSD_website/" target="_blank"><img src="https://img.shields.io/badge/Project%20Page-E91E63?logo=googlechrome&logoColor=white" alt="Project Page"></a> | |
| <a href="https://arxiv.org/abs/2611.31184" target="_blank"><img src="https://img.shields.io/badge/arXiv-2611.31184-b31b1b?logo=arxiv&logoColor=white" alt="Paper"></a> | |
| <a href="https://huggingface.co/spaces/HikariDawn/CodecOPSD-H3-Ref2VA" target="_blank"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Space-Demo-FF9D00" alt="Space"></a> | |
| <a href="https://huggingface.co/collections/HikariDawn/codecopsdopsd-6b04b49f98f5b4b68c5f7f9a"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-FFD21E" alt="Models"></a> | |
| </p> | |
| # CodecOPSD-H3-Ref2VA | |
| **On-Policy Codec Distillation for Efficient All-in-One Video Generation** | |
| Sequence-wise generators (MiniMax-H3 Ref2VA, MiniMax-H3-Image, Qwen-Image 2.1, FLUX 3 Image Klein) append every | |
| reference picture or video to the input token sequence, so the token cost grows sharply as more references are added. | |
| We propose **CodecOPSD** to prune the redundant condition tokens with a video codec, and we train a small LoRA on the | |
| kept tokens via on-policy self-distillation. | |
| On average, CodecOPSD drops about 70% of the condition tokens on MiniMax-H3 Ref2VA with almost unchanged quality and | |
| 1.87x faster denoising, and up to 8.4x faster with more conditions (three reference videos, higher-resolution | |
| references, more frames, and a higher drop rate). | |
| On MiniMax-H3-Image, it drops about 65% of the reference tokens and makes denoising about 2x faster. | |
| This repo holds the CodecOPSD LoRA for **MiniMax-H3 Ref2VA** (reference-to-video generation). | |
| β **If you like CodecOPSD, please help ββstarββ the [GitHub repo](https://github.com/Kiteretsu77/CodecOPSD). Thanks!** π€ | |
| ## Model Variants | |
| | Variant | Base model | Task | Weights | | |
| |---|---|---|---| | |
| | **CodecOPSD-H3-Ref2VA** (this repo) | [MiniMax-H3](https://huggingface.co/MiniMaxAI/MiniMax-H3) Ref2VA | Reference-to-video generation | [HikariDawn/CodecOPSD-H3-Ref2VA](https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA) | | |
| | **CodecOPSD-H3-Image** | [MiniMax-H3-Image](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image) | Reference-to-image generation | [HikariDawn/CodecOPSD-H3-Image](https://huggingface.co/HikariDawn/CodecOPSD-H3-Image) | | |
| | CodecOPSD on Cosmos 3 Nano | Cosmos 3 Nano | | Coming soon | | |
| | CodecOPSD on Qwen-Image 2.1 | Qwen-Image 2.1 | | Coming soon | | |
| | CodecOPSD on FLUX 3 Image Klein | FLUX 3 Image Klein | | Coming soon | | |
| ## Short Film | |
| **Robot versus Monster**: made with MiniMax-H3 Ref2VA + CodecOPSD in five generations, no Teacher run, no post-editing.<br> | |
| <sub>Greybox video + pictures β video Β· 768 x 1344, 737 frames Β· tokens 278,256 β 89,535 (β68%) Β· denoising 344.9 s on 1x B200</sub> | |
| <video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/film.mp4" autoplay muted loop playsinline controls width="100%"></video> | |
| Conditions of each part (hatched = tokens dropped by codec pruning): | |
| <details> | |
| <summary><b>References of all five parts</b>: the mech (front, back), the monster, two scenes</summary> | |
| <table><tr><td width="20%" align="center"><img src="assets/shortfilm/shared0.jpg" width="100%"><br><sub>Identity: mech, front β53%</sub></td><td width="20%" align="center"><img src="assets/shortfilm/shared1.jpg" width="100%"><br><sub>Identity: mech, back β54%</sub></td><td width="20%" align="center"><img src="assets/shortfilm/shared2.jpg" width="100%"><br><sub>Identity: monster β65%</sub></td><td width="20%" align="center"><img src="assets/shortfilm/shared3.jpg" width="100%"><br><sub>Scene: street β18%</sub></td><td width="20%" align="center"><img src="assets/shortfilm/shared4.jpg" width="100%"><br><sub>Scene: city from above β32%</sub></td></tr></table> | |
| </details> | |
| <details> | |
| <summary><b>Part 1</b>: draws its blade, charges, takes off Β· 141 frames Β· tokens 53,568 β 18,906 (β65%) Β· 67.1 s</summary> | |
| <table><tr><td width="50%" align="center"><video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/part1.mp4" autoplay muted loop playsinline width="100%"></video><br><sub>Output, part 1</sub></td><td width="50%" align="center"><video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/part1_greybox.mp4" autoplay muted loop playsinline width="100%"></video><br><sub>Greybox video β70%</sub></td></tr></table> | |
| <table><tr><td width="33%" align="center"><img src="assets/shortfilm/part1_in6.jpg" width="100%"><br><sub>First frame β13%</sub></td><td width="33%" align="center"><img src="assets/shortfilm/part1_in7.jpg" width="100%"><br><sub>Last frame β16%</sub></td><td width="33%" align="center"><img src="assets/shortfilm/part1_in5.jpg" width="100%"><br><sub>Thruster effect β87%</sub></td></tr></table> | |
| </details> | |
| <details> | |
| <summary><b>Part 2</b>: charges, slapped away by the right hand, recovers Β· 175 frames Β· tokens 63,648 β 17,458 (β73%) Β· 79.0 s</summary> | |
| <table><tr><td width="50%" align="center"><video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/part2.mp4" autoplay muted loop playsinline width="100%"></video><br><sub>Output, part 2</sub></td><td width="50%" align="center"><video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/part2_greybox.mp4" autoplay muted loop playsinline width="100%"></video><br><sub>Greybox video β79%</sub></td></tr></table> | |
| <table><tr><td width="33%" align="center"><img src="assets/shortfilm/part2_6.jpg" width="100%"><br><sub>First frame β30%</sub></td><td width="33%" align="center"><img src="assets/shortfilm/part2_7.jpg" width="100%"><br><sub>Last frame β24%</sub></td><td width="33%" align="center"><img src="assets/shortfilm/part2_5.jpg" width="100%"><br><sub>Key pose: hand β52%</sub></td></tr></table> | |
| </details> | |
| <details> | |
| <summary><b>Part 3</b>: giant-blade ultimate and the dive Β· 175 frames Β· tokens 62,112 β 18,961 (β69%) Β· 82.6 s</summary> | |
| <table><tr><td width="50%" align="center"><video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/part3.mp4" autoplay muted loop playsinline width="100%"></video><br><sub>Output, part 3</sub></td><td width="50%" align="center"><video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/part3_greybox.mp4" autoplay muted loop playsinline width="100%"></video><br><sub>Greybox video β75%</sub></td></tr></table> | |
| <table><tr><td width="50%" align="center"><img src="assets/shortfilm/part3_5.jpg" width="100%"><br><sub>First frame β23%</sub></td><td width="50%" align="center"><img src="assets/shortfilm/part3_6.jpg" width="100%"><br><sub>Last frame β23%</sub></td></tr></table> | |
| </details> | |
| <details> | |
| <summary><b>Part 4</b>: the cut and its extreme-wide replay Β· 106 frames Β· tokens 45,072 β 15,816 (β65%) Β· 50.8 s</summary> | |
| <table><tr><td width="50%" align="center"><video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/part4.mp4" autoplay muted loop playsinline width="100%"></video><br><sub>Output, part 4</sub></td><td width="50%" align="center"><video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/part4_greybox.mp4" autoplay muted loop playsinline width="100%"></video><br><sub>Greybox video β72%</sub></td></tr></table> | |
| <table><tr><td width="25%" align="center"><img src="assets/shortfilm/part4_5.jpg" width="100%"><br><sub>First frame β28%</sub></td><td width="25%" align="center"><img src="assets/shortfilm/part4_8.jpg" width="100%"><br><sub>Slash effect β62%</sub></td><td width="25%" align="center"><img src="assets/shortfilm/part4_6.jpg" width="100%"><br><sub>Wound, front β47%</sub></td><td width="25%" align="center"><img src="assets/shortfilm/part4_7.jpg" width="100%"><br><sub>Wound, back β54%</sub></td></tr></table> | |
| </details> | |
| <details> | |
| <summary><b>Part 5</b>: landing, push-in on the shield Β· 140 frames Β· tokens 53,856 β 18,394 (β66%) Β· 65.4 s</summary> | |
| <table><tr><td width="50%" align="center"><video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/part5.mp4" autoplay muted loop playsinline width="100%"></video><br><sub>Output, part 5</sub></td><td width="50%" align="center"><video src="https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA/resolve/main/assets/shortfilm/part5_greybox.mp4" autoplay muted loop playsinline width="100%"></video><br><sub>Greybox video β70%</sub></td></tr></table> | |
| <table><tr><td width="33%" align="center"><img src="assets/shortfilm/part5_6.jpg" width="100%"><br><sub>First frame β46%</sub></td><td width="33%" align="center"><img src="assets/shortfilm/part5_5.jpg" width="100%"><br><sub>Ring effect β82%</sub></td><td width="33%" align="center"><img src="assets/shortfilm/part5_7.jpg" width="100%"><br><sub>Wound, back β54%</sub></td></tr></table> | |
| </details> | |
| ## Gallery | |
| <a href="https://kiteretsu77.github.io/CodecOPSD_website/#gallery" target="_blank"><img src="assets/gallery_ref2va.webp" width="100%" alt="CodecOPSD MiniMax-H3 Ref2VA gallery"></a> | |
| ## Run it | |
| Install the [CodecOPSD code](https://github.com/Kiteretsu77/CodecOPSD) and download the base models into `models/`: | |
| ```bash | |
| git clone https://github.com/Kiteretsu77/CodecOPSD.git && cd CodecOPSD | |
| pip install -e ".[app]" | |
| python -m codecopsd.download minimax_h3_ref2va --no-examples | |
| python app.py ref2va # Gradio demo | |
| ``` | |
| The CodecOPSD pipeline is a diffusers `DiffusionPipeline` on diffusers' own MiniMax-H3 modules, with codec pruning in | |
| front of the transformer: | |
| ```python | |
| import torch | |
| from diffusers.utils import export_to_video | |
| from codecopsd import MiniMaxH3CodecOPSDPipeline | |
| from codecopsd.pipelines.minimax_h3_ref2va import load_reference | |
| pipe = MiniMaxH3CodecOPSDPipeline.from_minimax_h3( | |
| "models/MiniMax-H3-Ref2VA", text_encoder_fp8="fp8", | |
| text_encoder_path="models/MiniMax-H3-ModelOpt-Mixed9-Dynamic-FP8/Ref2VA/text_encoder") | |
| pipe.load_condition_lora("HikariDawn/CodecOPSD-H3-Ref2VA", weight_name="codecopsd_minimax_h3_ref2va.safetensors") | |
| pipe.enable_model_cpu_offload() | |
| video = pipe( | |
| prompt="The golden retriever from <Picture 1> chases and catches a flying red frisbee on the park lawn of " | |
| "<Picture 2>, running like the dog in <Video 1>. The camera tracks the dog.", | |
| references=[load_reference(f) for f in ["dog.jpg", "park.jpg", "dog_running.mp4"]], | |
| generator=torch.Generator().manual_seed(42), | |
| ).frames[0] | |
| export_to_video(video, "output.mp4", fps=24) | |
| ``` | |
| ## Weights | |
| | File | Base trunk | Format | | |
| |---|---|---| | |
| | `codecopsd_minimax_h3_ref2va.safetensors` | MiniMax-H3 `transformer_ref` | FP32 LoRA, rank / alpha 128, 2.6 GB | | |
| | `config.json` | | Base model, LoRA rank and alpha, version | | |
| | `LICENSE`, `NOTICE` | | The MiniMax H3 Community License Agreement and its required notice | | |
| ## License | |
| These LoRA weights are Model Derivatives of MiniMax H3 and are distributed under the | |
| [MiniMax H3 Community License Agreement](https://huggingface.co/MiniMaxAI/MiniMax-H3/blob/42ed227ee7df40d41602854ae760620d6eb651fe/LICENSE). | |
| See [NOTICE](NOTICE) for the required MiniMax notice and the CodecOPSD authors' copyright statement. The CodecOPSD code | |
| is on [GitHub](https://github.com/Kiteretsu77/CodecOPSD) under its own license. | |
| ## Citation | |
| ```bibtex | |
| @article{wang2026codecopsd, | |
| title = {On-Policy Codec Distillation for Efficient All-in-One Video Generation}, | |
| author = {Wang, Boyang and Blackburn-Matzen, Kevin and Saha, Oindrila and Gadelha, Matheus and Cheng, Zezhou}, | |
| journal = {arXiv preprint arXiv:2611.31184}, | |
| year = {2026} | |
| } | |
| ``` | |