# MiniMax H3 Reference to Video LoRA Trainer

> Train a MiniMax H3 LoRA with reference conditioning, so different modalities animate into video with audio; captions optional.


## Overview

- **Endpoint**: `https://fal.run/minimax/h3/ref2va/trainer`
- **Model ID**: `minimax/h3/ref2va/trainer`
- **Category**: training
- **Kind**: training


## Pricing

The cost of training depends on the number of steps. The formula is: 0.015 * steps. With 1000 steps, your request will cost **$15.00**.

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`training_data_url`** (`string`, _required_):
  URL to zip archive with videos or images of your subject. Try to use at least 10 files, although more is better.
  
  **Supported video formats:** .mp4, .mov, .avi, .mkv
  **Supported image formats:** .png, .jpg, .jpeg
  
  Note: The dataset must contain ONLY videos OR ONLY images - mixed datasets are not supported.
  
  Optional per-clip extras, matched by base name: a caption text file (`clip01.txt`), and ORDERED reference sidecars `clip01.ref_1.<ext>` .. `clip01.ref_4.<ext>` where the extension picks the modality — images (.png/.jpg/.jpeg), videos (.mp4/.mov/.avi/.mkv/.webm; their soundtrack becomes an audio reference too), or audio (.wav/.mp3/.flac/.m4a/.ogg/.aac). Clips without reference sidecars train against a frame of the clip itself as the reference.

- **`rank`** (`RankEnum`, _optional_):
  The rank of the LoRA adaptation. Higher values increase capacity but use more memory. Default value: `"32"`
  - Default: `32`
  - Options: `8`, `16`, `32`, `64`, `128`
  - Examples: 32

- **`number_of_steps`** (`integer`, _optional_):
  The number of training steps. Default value: `2000`
  - Default: `2000`
  - Range: `1` to `6000`
  - Examples: 2000

- **`learning_rate`** (`float`, _optional_):
  Learning rate for optimization. Higher values can lead to faster training but may cause overfitting. Default value: `0.0002`
  - Default: `0.0002`
  - Range: `0.000001` to `1`
  - Examples: 0.0002

- **`number_of_frames`** (`integer`, _optional_):
  Number of frames per training sample. Must satisfy frames % 17 == 5 (e.g., 22, 39, 56, 73, 90, 107, 124). Default value: `73`
  - Default: `73`
  - Range: `22` to `124`
  - Examples: 73

- **`frame_rate`** (`integer`, _optional_):
  Target frames per second for the video. Default value: `24`
  - Default: `24`
  - Range: `8` to `60`
  - Examples: 24

- **`resolution`** (`ResolutionEnum`, _optional_):
  Resolution to use for training. Higher resolutions require more memory. Default value: `"medium"`
  - Default: `"medium"`
  - Options: `"low"`, `"medium"`, `"high"`
  - Examples: "medium"

- **`aspect_ratio`** (`AspectRatioEnum`, _optional_):
  Aspect ratio to use for training. Matches the aspect ratios supported by the MiniMax H3 API. Default value: `"16:9"`
  - Default: `"16:9"`
  - Options: `"21:9"`, `"16:9"`, `"4:3"`, `"1:1"`, `"3:4"`, `"9:16"`
  - Examples: "16:9"

- **`trigger_phrase`** (`string`, _optional_):
  A phrase that will trigger the LoRA style. Will be prepended to captions during training. Default value: `""`
  - Default: `""`
  - Examples: ""

- **`reference_conditioning_p`** (`float`, _optional_):
  Probability of conditioning on the reference images during training. The remaining probability mass trains unconditioned text-to-video-audio, which keeps prompt-only generation stable. Default value: `0.9`
  - Default: `0.9`
  - Range: `0` to `1`

- **`resume_from_lora_url`** (`string`, _optional_):
  URL of a previously trained LoRA (.safetensors) from this trainer to WARM-START from: its weights initialize the adapter and training continues for number_of_steps more steps. Weights only — the optimizer and learning-rate schedule start fresh.

- **`auto_scale_input`** (`boolean`, _optional_):
  If true, videos will be automatically scaled to the target frame count and fps. This option has no effect on image datasets.
  - Default: `false`
  - Examples: false

- **`split_input_into_scenes`** (`boolean`, _optional_):
  If true, videos above a certain duration threshold will be split into scenes. Note: reference sidecars are dropped for clips that get split. Default value: `true`
  - Default: `true`
  - Examples: true

- **`split_input_duration_threshold`** (`float`, _optional_):
  The duration threshold in seconds. If a video is longer than this, it will be split into scenes. Default value: `30`
  - Default: `30`
  - Range: `1` to `60`
  - Examples: 30

- **`debug_dataset`** (`boolean`, _optional_):
  When enabled, the trainer returns a downloadable archive of your preprocessed training data for manual inspection. Use this to verify that your videos, images, captions and reference images were processed correctly before committing to a full training run.
  - Default: `false`

- **`strict_dataset`** (`boolean`, _optional_):
  Reject dataset-quality fallbacks during preprocessing, including captions that would use a blank prompt, missing reference sidecars, and videos without a readable audio track. By default these cases are reported in logs and use the documented fallback.
  - Default: `false`
  - Examples: false



**Required Parameters Example**:

```json
{
  "training_data_url": ""
}
```

**Full Example**:

```json
{
  "training_data_url": "",
  "rank": 32,
  "number_of_steps": 2000,
  "learning_rate": 0.0002,
  "number_of_frames": 73,
  "frame_rate": 24,
  "resolution": "medium",
  "aspect_ratio": "16:9",
  "trigger_phrase": "",
  "reference_conditioning_p": 0.9,
  "auto_scale_input": false,
  "split_input_into_scenes": true,
  "split_input_duration_threshold": 30,
  "strict_dataset": false
}
```


### Output Schema

The API returns the following output format:

- **`lora_file`** (`File`, _required_):
  URL to the trained LoRA weights (.safetensors).

- **`config_file`** (`File`, _required_):
  Configuration used for setting up inference endpoints.

- **`debug_dataset`** (`File`, _optional_):
  A downloadable archive containing the preprocessed training data. Only present when `debug_dataset` is enabled in the input.



**Example Response**:

```json
{
  "lora_file": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019
  },
  "config_file": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/minimax/h3/ref2va/trainer \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "training_data_url": ""
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "minimax/h3/ref2va/trainer",
    arguments={
        "training_data_url": ""
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("minimax/h3/ref2va/trainer", {
  input: {
    training_data_url: ""
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/minimax/h3/ref2va/trainer)
- [API Documentation](https://fal.ai/models/minimax/h3/ref2va/trainer/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=minimax/h3/ref2va/trainer)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
