# Turbo Flux Trainer

> A blazing fast FLUX dev LoRA trainer for subjects and styles.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/turbo-flux-trainer`
- **Model ID**: `fal-ai/turbo-flux-trainer`
- **Category**: training
- **Kind**: training
**Description**: A blazing fast FLUX dev LoRA trainer for subjects and styles.



## Pricing

Your request will cost **$2.40** per **1000-step** training run. It scales per step, so a **2000-step** training run costs **$4.80**. For **$2.40** 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 of a consistent style. Try to use at least 10 images, although more is better.

- **`trigger_phrase`** (`string`, _optional_):
  Trigger phrase to be used in the captions. If None, a trigger word will not be used.
  If no captions are provide the trigger_work will be used instead of captions. If captions are provided, the trigger word will replace the `[trigger]` string in the captions. Default value: `"ohwx"`
  - Default: `"ohwx"`

- **`steps`** (`integer`, _optional_):
  Number of steps to train the LoRA on. Default value: `1000`
  - Default: `1000`
  - Range: `1` to `10000`
  - Examples: 1000

- **`learning_rate`** (`float`, _optional_):
  Learning rate for the training. Default value: `0.00115`
  - Default: `0.00115`
  - Range: `1e-7` to `0.01`

- **`training_style`** (`Enum`, _optional_):
  Training style to use. Default value: `subject`
  - Default: `"subject"`
  - Options: `"subject"`, `"style"`

- **`face_crop`** (`boolean`, _optional_):
  Whether to try to detect the face and crop the images to the face. Default value: `true`
  - Default: `true`



**Required Parameters Example**:

```json
{
  "images_data_url": ""
}
```

**Full Example**:

```json
{
  "images_data_url": "",
  "trigger_phrase": "ohwx",
  "steps": 1000,
  "learning_rate": 0.00115,
  "training_style": "subject",
  "face_crop": 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 trained diffusers config 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/turbo-flux-trainer \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "images_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(
    "fal-ai/turbo-flux-trainer",
    arguments={
        "images_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("fal-ai/turbo-flux-trainer", {
  input: {
    images_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/fal-ai/turbo-flux-trainer)
- [API Documentation](https://fal.ai/models/fal-ai/turbo-flux-trainer/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/turbo-flux-trainer)

### 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)
