> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/models/minimax-h3/fine-tune-minimax-h3.md). Agents can also search and read this documentation through its [MCP server](https://unsloth.ai/docs/~gitbook/mcp).

# Fine-tune MiniMax-H3

Train and use a MiniMax-H3 video LoRA locally with Unsloth.

See [MiniMax-H3](https://unsloth.ai/docs/models/minimax-h3.md) on setting MiniMax-H3 up before finetuning

#### MiniMax-H3 LoRA finetuning - Before and after

Unsloth also allows you to finetune MiniMax-H3! For example with 864 × 480, 5.2 s, 20 steps, seed 42, both on the original bf16 model in Unsloth. Prompt: "bbbstyle, a sunny meadow with a big oak tree and a small stream, birds chirping" we show before and after finetuning's style:

<div><figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FY40HyPvTZusQH0RDXU4I%2Fminimax-h3-lora-studio-before.webp?alt=media" alt="Without the LoRA: a realistic meadow with a big oak tree and a small stream under a blue sky"><figcaption><p>Without LoRA</p></figcaption></figure> <figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FQxzr4zJRmMzlFE6OHCDi%2Fminimax-h3-lora-studio-after.webp?alt=media" alt="With the LoRA: the same meadow in a 3D animated film look, with a stylized oak tree, bright green grass and a small stream"><figcaption><p>With bbbstyle LoRA, 200 steps</p></figcaption></figure></div>

### Train a LoRA

MiniMax-H3 learns sound and picture together, so every training clip needs a soundtrack. This example teaches the look of *Big Buck Bunny* (CC BY 3.0, Blender Foundation) with the trigger `bbbstyle`: 12 one-second clips, 400 steps, default settings.

{% stepper %}
{% step %}

#### Prepare clips

* Formats: `.mp4`, `.mov`, `.mkv`, `.webm`, `.m4v`, `.avi`.
* Caption: a `.txt` with the same name, for example `clip01.mp4` and `clip01.txt`.
* Start each caption with the trigger:

| Clip         | Caption (`.txt`)                                                       |
| ------------ | ---------------------------------------------------------------------- |
| `clip01.mp4` | bbbstyle, a sunny meadow with tall pine trees under a pink evening sky |
| `clip02.mp4` | bbbstyle, a grassy mound with a small burrow under a big tree          |

* Unsloth trains the first 22 frames (0.92 s) of each clip at 24 fps.
* Sound must cover the whole clip. Silent clips are refused.
* Canvas short edge is 768 px, center-cropped.

<figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FOCh4qLqcFJo97JERYZRl%2Fminimax-h3-train-clips.webp?alt=media" alt="Twelve frames from the twelve Big Buck Bunny training clips: meadows, a big white rabbit, a squirrel, a forest and a flying squirrel"><figcaption><p>The 12 training clips</p></figcaption></figure>
{% endstep %}

{% step %}

#### Upload and pick MiniMax-H3

On the Video page, click **Train**. Under **Training images**, name the set and click **Upload** to add the clips and captions. Then pick **MiniMaxAI/MiniMax-H3** from the model menu at the top left. MiniMax-H3 appears there only once a set of clips exists.

<figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FbKXNr7dAmpLqlDqS8ASz%2Fminimax-h3-train-family.png?alt=media" alt="Train a LoRA panel with Model family MiniMax-H3, the 31B and QLoRA 80GB+ VRAM chips, base model MiniMaxAI/MiniMax-H3 and the bbbstyle set of 12 clips" width="400"><figcaption><p>MiniMax-H3 with 12 clips</p></figcaption></figure>
{% endstep %}

{% step %}

#### Check settings

| Setting        | Default                               |
| -------------- | ------------------------------------- |
| Steps          | 500 (we used 400)                     |
| LoRA rank      | 16                                    |
| Learning rate  | 0.0001, constant with 20 warmup steps |
| Resolution     | 768 (short edge)                      |
| Batch          | 1 (use Grad accumulation for more)    |
| Base precision | Auto (4-bit nf4)                      |

<figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FdIPdXwTZewVqXyaMdl5S%2Fminimax-h3-train-settings.png?alt=media" alt="Train settings: 400 steps, LoRA rank 16, resolution 768, grad accumulation 1, seed 42, learning rate 0.0001, constant with warmup, 20 warmup steps, gradient checkpointing on, base precision Auto"><figcaption><p>Train settings</p></figcaption></figure>
{% endstep %}

{% step %}

#### Start training

Click **Start training**. Unsloth downloads the original model the first time, encodes the captions and clips, then trains. Progress, loss and gradient norm update live. There are no preview images.

<figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FgXN7e8Zv8N6JvtPji9g6%2Fminimax-h3-train-progress.png?alt=media" alt="Training at step 95 of 400 with loss 0.7323, average loss 0.6318, speed 0.25 clips per second, 49.7 GB peak VRAM and the training loss chart"><figcaption><p>Step 95 of 400, about 4 s per step</p></figcaption></figure>
{% endstep %}

{% step %}

#### Get the LoRA

The finished run shows **Adapter ready** and the path: `~/.unsloth/studio/outputs/<adapter name>/pytorch_lora_weights.safetensors`.

<figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FAVSMrcULjfi59HHFICx7%2Fminimax-h3-train-done.png?alt=media" alt="Training complete at 400 of 400 steps, Adapter ready, saved to /root/.unsloth/studio/outputs/bbbstyle-h3/pytorch_lora_weights.safetensors, with the loss chart"><figcaption><p>Finished run</p></figcaption></figure>

Final loss 0.61 (video 0.44, audio 0.17). Total time 36 min: 9 min to load and encode, 27 min to train.
{% endstep %}
{% endstepper %}

#### Use the LoRA

Click **Deploy to Video** on the finished run. Unsloth loads the original MiniMax-H3 with the LoRA merged in and switches to **Create**.

<figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FotOYZO1kXlDOXFEJW5ZR%2Fminimax-h3-lora-deploy.png?alt=media" alt="Finished MiniMax-H3 run with Adapter ready and the Deploy to Video, Export and Train another buttons"><figcaption><p>Deploy to Video</p></figcaption></figure>

{% stepper %}
{% step %}

#### Load with the LoRA

Choose **Text and frames**. The LoRA loads on the original bf16 MiniMax-H3, not the Fast FP8 one, so the first load downloads about 144 GB. The **LoRAs** field shows the adapter at weight 1.

<figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FNlCAmCRgONu80gBqVUD9%2Fminimax-h3-lora-field.png?alt=media" alt="LoRAs field with bbbstyle-h3 at weight 1 and the note Baked into the loaded model: bbbstyle-h3" width="340"><figcaption><p>LoRAs field</p></figcaption></figure>

Loading took about 9 min on an RTX PRO 6000 with the files already downloaded, using about 68 GB of GPU memory.
{% endstep %}

{% step %}

#### Generate

Start the prompt with the trigger `bbbstyle` and click **Generate**. One 864 × 480, 5.2 s video took about 1 min.

<figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FaZxSQkqddVocBUAMuwde%2Fminimax-h3-lora-result.png?alt=media" alt="Video page with the bbbstyle meadow video in the preview and the gallery below"><figcaption><p>Result with the LoRA, seed 42</p></figcaption></figure>
{% endstep %}

{% step %}

#### Change or remove the LoRA

LoRAs are merged when the model loads. Use **Add LoRA**, the weight slider (0 to 2) or the bin icon, then click **Reload to apply**.

<figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FeXzG2DEXJPfHKnPKfT6s%2Fminimax-h3-lora-reload.png?alt=media" alt="LoRAs field after removing the adapter, with the note LoRAs are merged at load and a Reload to apply button" width="340"><figcaption><p>Reload to apply</p></figcaption></figure>
{% endstep %}
{% endstepper %}

<figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fn6sB4m3vtneQRQmEWwij%2Fminimax-h3-lora-flow.webp?alt=media" alt="Animation: click Deploy to Video, choose Text and frames, wait for the load, type the bbbstyle prompt, click Generate and play the result"><figcaption><p>Deploy to Video, sped up</p></figcaption></figure>

LoRAs need the original repo. The GGUF and Fast FP8 entries cannot load them.

#### Outside Unsloth: diffusers

To use the LoRA in your own Python code, use diffusers. This needs the original model (about 144 GB) and an 80 GB+ GPU or plenty of system RAM.

{% code collapsedlinecount="10" %}

```bash
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu130
pip install "diffusers==0.42.1" "transformers==5.5.0" peft accelerate soundfile imageio imageio-ffmpeg
```

{% endcode %}

Copy the `bbbstyle-h3` folder next to the script. It renders the same prompt and seed with the LoRA off, then on:

{% code collapsedlinecount="10" %}

```python
import soundfile as sf
import torch
from diffusers import ComponentsManager, ModularPipeline
from diffusers.utils import export_to_video

manager = ComponentsManager()
pipe = ModularPipeline.from_pretrained("MiniMaxAI/MiniMax-H3", workflow="t2va", components_manager=manager)
pipe.load_components(dtype=torch.bfloat16)
pipe.transformer.load_lora_adapter("bbbstyle-h3/pytorch_lora_weights.safetensors", prefix="transformer")
manager.enable_auto_cpu_offload(device="cuda")


def render(name):
    result = pipe(
        prompt="bbbstyle, a sunny meadow with a big oak tree and a small stream, birds chirping",
        height=480,
        width=864,
        num_frames=124,
        num_inference_steps=20,
        generator=torch.Generator("cpu").manual_seed(42),
    )
    export_to_video(result.videos[0], f"{name}.mp4", fps=24)
    sf.write(f"{name}.wav", result.audio[0].float().cpu().numpy().T, result.sampling_rate)


pipe.transformer.disable_lora()
render("meadow_base")
pipe.transformer.enable_lora()
render("meadow_bbbstyle")
```

{% endcode %}

Both videos took about 10 min on an RTX PRO 6000, including loading. The same pair with the 400-step LoRA:

<div><figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FQ9SnobeErT5EubX2JC3I%2Fminimax-h3-lora-meadow-before.webp?alt=media" alt="Without the LoRA: a realistic meadow with a big oak tree and a small stream under a blue sky"><figcaption><p>Without LoRA</p></figcaption></figure> <figure><img src="https://3215535692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FLrEdDhkeBntupm1TbjDb%2Fminimax-h3-lora-meadow-after.webp?alt=media" alt="With the LoRA: the same meadow in a 3D animated film look, with stylized oak trees, soft light and a small animated character"><figcaption><p>With bbbstyle LoRA, 400 steps</p></figcaption></figure></div>

### Troubleshooting

<details>

<summary>MiniMax-H3 is not in the Train model list</summary>

Upload a set of clips first. MiniMax-H3 cannot train on still images.

</details>

<details>

<summary>A clip is refused</summary>

Each clip needs at least 0.92 s of video and a soundtrack for its full length. The aspect ratio must be between 1:4 and 4:1.

</details>

<details>

<summary>Training runs out of memory</summary>

Keep **Base precision** on **Auto** and gradient checkpointing on. FP8 base precision is not supported.

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/models/minimax-h3/fine-tune-minimax-h3.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
