# Train Hunyuan LoRA

> Train Hunyuan Video lora on people, objects, characters and more!


## Overview

- **Endpoint**: `https://fal.run/fal-ai/hunyuan-video-lora-training`
- **Model ID**: `fal-ai/hunyuan-video-lora-training`
- **Category**: training
- **Kind**: training
**Tags**: lora, personalization



## Pricing

Your request will cost **$5 per training run** (scales linearly with steps). For **$5** you can run this model with **approximately 1 times**.

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:


- **`images_data_url`** (`string`, _required_):
  URL to zip archive with images. Try to use at least 4 images in general the more the better.
  
  In addition to images the archive can contain text files with captions. Each text file should have the same name as the image file it corresponds to.

- **`steps`** (`integer`, _required_):
  Number of steps to train the LoRA on.
  - Range: `1` to `5000`
  - Examples: 1000

- **`trigger_word`** (`string`, _optional_):
  The trigger word to use. Default value: `""`
  - Default: `""`

- **`learning_rate`** (`float`, _optional_):
  Learning rate to use for training. Default value: `0.0001`
  - Default: `0.0001`

- **`do_caption`** (`boolean`, _optional_):
  Whether to generate captions for the images. Default value: `true`
  - Default: `true`

- **`data_archive_format`** (`string`, _optional_):
  The format of the archive. If not specified, the format will be inferred from the URL.



**Required Parameters Example**:

```json
{
  "images_data_url": "",
  "steps": 1000
}
```

**Full Example**:

```json
{
  "images_data_url": "",
  "steps": 1000,
  "learning_rate": 0.0001,
  "do_caption": true
}
```


### Output Schema

The API returns the following output format:

- **`diffusers_lora_file`** (`File`, _required_):
  URL to the trained diffusers lora weights.

- **`config_file`** (`File`, _required_):
  URL to the lora configuration file.



**Example Response**:

```json
{
  "diffusers_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/fal-ai/hunyuan-video-lora-training \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "images_data_url": "",
     "steps": 1000
   }'
```

### 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(
    "fal-ai/hunyuan-video-lora-training",
    arguments={
        "images_data_url": "",
        "steps": 1000
    },
    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("fal-ai/hunyuan-video-lora-training", {
  input: {
    images_data_url: "",
    steps: 1000
  },
  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/fal-ai/hunyuan-video-lora-training)
- [API Documentation](https://fal.ai/models/fal-ai/hunyuan-video-lora-training/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/hunyuan-video-lora-training)

### fal.ai Platform

- [Platform Documentation](https://docs.fal.ai)
- [Python Client](https://docs.fal.ai/clients/python)
- [JavaScript Client](https://docs.fal.ai/clients/javascript)
