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

# Image Generation

> Fine-tune an image generation model for custom styles

## Overview

Fine-tune image generation models to create images in your specific style, brand, or artistic direction. Perfect for branded content, character design, or artistic styles.

## Your Data

Your training data should have:

* **Image column** - Paths or URLs to your training images
* **Caption column** - Text descriptions of each image

Example data in `images.parquet`:

| image          | caption                             |
| -------------- | ----------------------------------- |
| images/001.jpg | a red sports car in cyberpunk style |
| images/002.jpg | a blue sedan in cyberpunk style     |
| images/003.jpg | a motorcycle in cyberpunk style     |

## Minimal Example

<CodeGroup>
  ```python Python theme={null}
  import requests

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

  # Create fine-tune
  data = {
      "resource": "main/images.parquet",
      "base_model": "black-forest-labs/FLUX.1-dev",
      "script_type": "image_generation",
      "training_params": {
          "image_column": "image",         # Your image column name
          "caption_column": "caption",     # Your caption column name
          "steps": 2000
      }
  }

  response = requests.post(url, headers=headers, json=data)
  fine_tune_id = response.json()["fine_tune"]["id"]

  # Start training
  run_url = f"{url}/{fine_tune_id}/actions/run"
  requests.post(run_url, headers=headers)

  print(f"Fine-tune started: {fine_tune_id}")
  ```

  ```bash cURL theme={null}
  # Create fine-tune
  curl -X POST https://hub.oxen.ai/api/repos/YOUR_NAMESPACE/YOUR_REPO/fine_tunes \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "resource": "main/images.parquet",
      "base_model": "black-forest-labs/FLUX.1-dev",
      "script_type": "image_generation",
      "training_params": {
        "image_column": "image",
        "caption_column": "caption",
        "steps": 2000
      }
    }'

  # Start training (use the ID from the response)
  curl -X POST https://hub.oxen.ai/api/repos/YOUR_NAMESPACE/YOUR_REPO/fine_tunes/FINE_TUNE_ID/actions/run \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```
</CodeGroup>

## Key Parameters

Only these fields are required to start:

| Parameter        | Description                                  | Example                                  |
| ---------------- | -------------------------------------------- | ---------------------------------------- |
| `image_column`   | Name of your image column                    | `"image"`, `"file"`, `"path"`            |
| `caption_column` | Name of your caption/prompt column           | `"caption"`, `"prompt"`, `"description"` |
| `steps`          | Number of training steps (1000-3000 typical) | `2000`                                   |

All other parameters use sensible defaults.

## Supported Models

Popular choices for image generation:

* `black-forest-labs/FLUX.1-dev` - High quality, state-of-the-art
* `black-forest-labs/FLUX.2-dev` - Latest version, even better quality
* `Qwen/Qwen-Image` - Fast, good for quick iterations

<Note>
  See the [full model list](/fine-tuning-api/reference/image_generation#supported-models) for all available options.
</Note>

## Data Requirements

For best results:

* **Quantity**: 10-50 images minimum, 100-500 images ideal
* **Quality**: High resolution, consistent style
* **Captions**: Descriptive prompts that explain what makes your images unique
* **Consistency**: Images should share common elements (style, subject, theme)

## Monitor Progress

Image models generate sample outputs during training. Check them to see progress:

```python theme={null}
status_url = f"https://hub.oxen.ai/api/repos/YOUR_NAMESPACE/YOUR_REPO/fine_tunes/{fine_tune_id}"
response = requests.get(status_url, headers=headers)
fine_tune = response.json()["fine_tune"]

print(f"Status: {fine_tune['status']}")
print(f"Current step: {fine_tune.get('current_step', 0)}")

# Sample images are generated every 200 steps by default
if "sample_outputs" in fine_tune:
    print(f"Sample images: {fine_tune['sample_outputs']}")
```

## Next Steps

* [Advanced parameters](/fine-tuning-api/reference/image_generation) - Learning rate, LoRA, sampling settings
* [Deploy your model](/getting-started/inference) - Generate images with your fine-tuned model
* [Parameter guide](/fine-tuning-api/parameters) - Understanding training parameters

## Common Issues

<AccordionGroup>
  <Accordion title="Images not loading">
    Ensure image paths are relative to your repository root, or use full URLs. Check that images are committed to your Oxen repository.
  </Accordion>

  <Accordion title="Out of memory error">
    Reduce `batch_size` to 1. Image models require significant GPU memory.
  </Accordion>

  <Accordion title="Results don't match my style">
    Try training for more steps (3000-5000) or increase your dataset size. Ensure captions clearly describe the unique aspects of your style.
  </Accordion>

  <Accordion title="Training taking too long">
    Start with 1000 steps for testing. FLUX models take 1-2 hours on GPU for 2000 steps.
  </Accordion>
</AccordionGroup>
