Download README.md from HikariDawn/CodecOPSD-H3-Image: direct link, hf CLI and curl.
- Browser
- Download file 5.82 kB
-
https://huggingface.co/HikariDawn/CodecOPSD-H3-Image/resolve/main/README.md
- Command line
-
hf download hf://HikariDawn/CodecOPSD-H3-Image/README.md
-
curl -L -o README.md https://huggingface.co/HikariDawn/CodecOPSD-H3-Image/resolve/main/README.md
license: other
license_name: minimax-h3-image-community-license-agreement
license_link: LICENSE
base_model: MiniMaxAI/MiniMax-H3-Image
base_model_relation: adapter
pipeline_tag: image-to-image
language:
- en
tags:
- lora
- image-generation
- reference-to-image
- token-pruning
- distillation
- minimax-h3
CodecOPSD-H3-Image
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-Image (reference-to-image generation).
⭐ If you like CodecOPSD, please help ⭐⭐star⭐⭐ the GitHub repo. Thanks! 🤗
Model Variants
| Variant | Base model | Task | Weights |
|---|---|---|---|
| CodecOPSD-H3-Ref2VA | MiniMax-H3 Ref2VA | Reference-to-video generation | HikariDawn/CodecOPSD-H3-Ref2VA |
| CodecOPSD-H3-Image (this repo) | MiniMax-H3-Image | Reference-to-image generation | 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 |
Gallery
Click the gallery to open it on the project page.
Run it
Install the CodecOPSD code and download the base models into models/:
git clone https://github.com/Kiteretsu77/CodecOPSD.git && cd CodecOPSD
pip install -e ".[app]"
python -m codecopsd.download minimax_h3_image --no-examples
python app.py ref2image # Gradio demo
The CodecOPSD pipeline is a diffusers DiffusionPipeline on diffusers' own MiniMax-H3 modules, with codec pruning in
front of the transformer:
import torch
from PIL import Image
from codecopsd import MiniMaxH3ImageCodecOPSDPipeline
pipe = MiniMaxH3ImageCodecOPSDPipeline.from_minimax_h3_image(
"models/MiniMax-H3-Image", text_encoder_fp8="fp8",
text_encoder_path="models/MiniMax-H3-ModelOpt-Mixed9-Dynamic-FP8/Ref2VA/text_encoder")
pipe.load_condition_lora("HikariDawn/CodecOPSD-H3-Image", weight_name="codecopsd_minimax_h3_image.safetensors")
pipe.enable_model_cpu_offload()
image = pipe(
prompt="Put the lamp <Picture 1> on the desk in <Picture 2>.",
images=[Image.open("lamp.jpg"), Image.open("desk.jpg")],
generator=torch.Generator().manual_seed(42),
).images[0]
image.save("output.png")
Weights
| File | Base trunk | Format |
|---|---|---|
codecopsd_minimax_h3_image.safetensors |
MiniMax-H3-Image transformer_diffusers |
FP32 LoRA, rank / alpha 128, 2.6 GB |
config.json |
Base model, LoRA rank and alpha, version | |
LICENSE, NOTICE |
The MiniMax-H3-Image Community License Agreement and its required notice |
License
These LoRA weights are Model Derivatives of MiniMax-H3-Image and are distributed under the MiniMax-H3-Image Community License Agreement.
See NOTICE for the required MiniMax notice and the CodecOPSD authors' copyright statement. The CodecOPSD code is on GitHub under its own license.
Citation
@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}
}
