> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oxen.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Fine-Tune: Multi Image Editing

> Fine-tune a model to take multiple images as input and output an image as output

## Overview

This schema is used for fine-tuning models with **multi image editing** capabilities.

### Schema Type

When creating a fine-tune with this schema, use:

```json theme={null}
{
  "resource": "main/your-dataset.parquet",
  "base_model": "<model-canonical-name>",
  "script_type": "multi_image_editing",
  "training_params": {
    ...
  }
}
```

**Key Parameters:**

* `script_type`: `multi_image_editing` (the fine-tune type)
* `base_model`: One of the supported model canonical names below

### Supported Models

* Qwen Image Edit - 2509 (`Qwen/Qwen-Image-Edit-2509`)
* Qwen Image Edit - 2511 (`Qwen/Qwen-Image-Edit-2511`)

## Request Schema

### Required Fields

| Field                   | Type    | Required | Description                                                                        |
| ----------------------- | ------- | -------- | ---------------------------------------------------------------------------------- |
| `batch_size`            | integer | No       | Batch Size (default: 1) (min: 1)                                                   |
| `caption_column`        | string  | Yes      | Caption Column (DataFrame column name)                                             |
| `control_image_columns` | array   | Yes      | Control Image Columns (inputs) (array of string) (Multiple DataFrame column names) |
| `gradient_accumulation` | integer | No       | Gradient Accumulation (default: 1) (min: 1)                                        |
| `image_column`          | string  | Yes      | Image Column (output) (DataFrame column name)                                      |
| `learning_rate`         | number  | No       | Learning Rate (default: 0.0002)                                                    |
| `lora_alpha`            | integer | No       | LoRA Alpha (default: 16) (min: 1)                                                  |
| `lora_rank`             | integer | No       | LoRA Rank (default: 16) (min: 1)                                                   |
| `sample_every`          | integer | No       | Sample Every (default: 200) (min: 1)                                               |
| `sample_height`         | integer | No       | Sample Height (default: 1024) (min: 1)                                             |
| `sample_width`          | integer | No       | Sample Width (default: 1024) (min: 1)                                              |
| `samples`               | array   | No       | Samples (array of object)                                                          |
| `steps`                 | integer | No       | Steps (default: 3000) (min: 1)                                                     |
| `timestep_type`         | string  | No       | Timestep Type (options: weighted, sigmoid, linear)                                 |
| `use_lora`              | boolean | No       | Use LoRA                                                                           |

## Example Request

<CodeGroup>
  ```json Request Body theme={null}
  {
    "resource": "main/your-dataset.parquet",
    "base_model": "<model-canonical-name>",
    "script_type": "multi_image_editing",
    "training_params": {
      "batch_size": 1,
      "caption_column": "",
      "control_image_columns": [],
      "gradient_accumulation": 1,
      "image_column": "",
      "learning_rate": 0.0002,
      "lora_alpha": 16,
      "lora_rank": 16,
      "sample_every": 200,
      "sample_height": 1024,
      "sample_width": 1024,
      "samples": [
        {
          "ctrl_img_urls": [
            "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png",
            "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png"
          ],
          "prompt": "an ox holding a sign that says 'Oxen.ai'"
        },
        {
          "ctrl_img_urls": [
            "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png",
            "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png"
          ],
          "prompt": "a herd of oxen running in a field"
        }
      ],
      "steps": 3000,
      "timestep_type": "weighted",
      "use_lora": true
    }
  }
  ```

  ```python Python theme={null}
  import requests

  url = "https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/fine_tunes"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
  }

  data = {{
    "resource": "main/your-dataset.parquet",
    "base_model": "<model-canonical-name>",
    "script_type": "multi_image_editing",
    "training_params": {{
      "batch_size": 1,
      "caption_column": "",
      "control_image_columns": [],
      "gradient_accumulation": 1,
      "image_column": "",
      "learning_rate": 0.0002,
      "lora_alpha": 16,
      "lora_rank": 16,
      "sample_every": 200,
      "sample_height": 1024,
      "sample_width": 1024,
      "samples": [
        {{
          "ctrl_img_urls": [
            "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png",
            "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png"
          ],
          "prompt": "an ox holding a sign that says 'Oxen.ai'"
        }},
        {{
          "ctrl_img_urls": [
            "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png",
            "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png"
          ],
          "prompt": "a herd of oxen running in a field"
        }}
      ],
      "steps": 3000,
      "timestep_type": "weighted",
      "use_lora": true
    }}
  }}

  response = requests.post(url, headers=headers, json=data)
  print(response.json())
  ```

  ```bash cURL theme={null}
  curl -X POST https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/fine_tunes \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{   "resource": "main/your-dataset.parquet",   "base_model": "<model-canonical-name>",   "script_type": "multi_image_editing",   "training_params": {     "batch_size": 1,     "caption_column": "",     "control_image_columns": [],     "gradient_accumulation": 1,     "image_column": "",     "learning_rate": 0.0002,     "lora_alpha": 16,     "lora_rank": 16,     "sample_every": 200,     "sample_height": 1024,     "sample_width": 1024,     "samples": [       {         "ctrl_img_urls": [           "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png",           "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png"         ],         "prompt": "an ox holding a sign that says 'Oxen.ai'"       },       {         "ctrl_img_urls": [           "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png",           "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png"         ],         "prompt": "a herd of oxen running in a field"       }     ],     "steps": 3000,     "timestep_type": "weighted",     "use_lora": true   } }'
  ```
</CodeGroup>

## Field Details

### `batch_size`

**Batch Size**

**Type:** `integer`

**Default:** `1`

**Minimum:** `1`

### `caption_column`

**Caption Column**

**Type:** `string`

**Default:** `""`

### `control_image_columns`

**Control Image Columns (inputs)**

**Type:** `array`

**Default:** `[]`

### `gradient_accumulation`

**Gradient Accumulation**

**Type:** `integer`

**Default:** `1`

**Minimum:** `1`

### `image_column`

**Image Column (output)**

**Type:** `string`

**Default:** `""`

### `learning_rate`

**Learning Rate**

**Type:** `number`

**Default:** `0.0002`

### `lora_alpha`

**LoRA Alpha**

**Type:** `integer`

**Default:** `16`

**Minimum:** `1`

### `lora_rank`

**LoRA Rank**

**Type:** `integer`

**Default:** `16`

**Minimum:** `1`

### `sample_every`

**Sample Every**

**Type:** `integer`

How often to generate samples during training (n steps)

**Default:** `200`

**Minimum:** `1`

### `sample_height`

**Sample Height**

**Type:** `integer`

**Default:** `1024`

**Minimum:** `1`

### `sample_width`

**Sample Width**

**Type:** `integer`

**Default:** `1024`

**Minimum:** `1`

### `samples`

**Samples**

**Type:** `array`

Used to show progress during the fine-tuning process

**Default:** `[{"ctrl_img_urls": ["https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png", "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png"], "prompt": "an ox holding a sign that says 'Oxen.ai'"}, {"ctrl_img_urls": ["https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png", "https://hub.oxen.ai/api/repos/ox/Oxen-Character-Simple-Vector-Graphic/file/main/images/reference/bloxy_white_bg.png"], "prompt": "a herd of oxen running in a field"}]`

### `steps`

**Steps**

**Type:** `integer`

**Default:** `3000`

**Minimum:** `1`

### `timestep_type`

**Timestep Type**

**Type:** `string`

**Default:** `"weighted"`

**Options:** `weighted`, `sigmoid`, `linear`

### `use_lora`

**Use LoRA**

**Type:** `boolean`

**Default:** `true`
