Fine-Tunes

Learn about Fine-Tuning a Stable Diffusion Model with your pictures. Fine-Tune a model, retrieve, delete, and list Fine-Tunes.

The Fine-Tune Model

The Fine-Tune Model contains all the information you need about Fine-Tuning a Stable Diffusion Model. It also contains the prompts that you run to your Fine-Tune Model in Bodia.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier of the Fine-Tune.

  • Name
    title
    Type
    string
    Description

    The Title of the Fine-Tune.

  • Name
    name
    Type
    string
    Description

    This is the name of the identifier object. It must be included in every prompt.

  • Name
    token
    Type
    string
    Description

    Token, together with the name property which references the identifier object. If it is not included in the Prompt, it is automatically included just before the object name. Recommended Options: zwx, ukj or sks

  • Name
    images_url
    Type
    array
    Description

    The images used to Fine-Tune the model.

  • Name
    model
    Type
    string
    Description

    Options: sd1.5, sd2.1 or openjourney2. The base Stable Diffusion Model you want to Fine-Tune.

  • Name
    prompts
    Type
    array
    Description

    You can Fine-Tune a Stable Diffusion Model with pre-made prompts. You can see the prompt properties in the Prompt Properties section below.

  • Name
    styles
    Type
    array
    Description

    You can also Fine Tune a Stable Diffusion Model using Styles, created by you or the public ones. You can see the collections and styles properties in the Styles Properties and Collections Properties sections.

  • Name
    steps
    Type
    number
    Description

    Number of training steps (minimum: 500; maximum: 5000).

  • Name
    metadata
    Type
    JSON
    Description

    You can add metadata info about your Fine-Tune, like user_id, as well as other information you want to include to integrate it with your system.

  • Name
    error_message
    Type
    string
    Description

    An error message just in case any errors occur.


POST/v1/finetunes

Create Fine-Tune

This endpoint allows you to Fine-Tune a new Model and adds prompts to it.

Required attributes

  • Name
    title
    Type
    string
    Description

    The Title of the Fine-Tune.

  • Name
    name
    Type
    string
    Description

    This is the name of the identifier object. It must be included in every prompt.

  • Name
    token
    Type
    string
    Description

    Token that together with the name property references the identifier object. If it is not included in the Prompt, it is automatically included just before the object name. Recommended Options: zwx, ukj or sks

  • Name
    images_url
    Type
    array
    Description

    The images to Fine-Tune the model.

Optional attributes

  • Name
    model
    Type
    string
    Description

    Options: sd1.5, sd2.1 or openjourney2. The base Stable Diffusion Model you want to Fine-Tune.

  • Name
    prompts
    Type
    array
    Description

    You can Fine-Tune a Stable Diffusion Model with pre-made prompts. You can see the prompts properties in the Prompts Properties section below.

  • Name
    styles
    Type
    array
    Description

    You can also Fine Tune a Stable Diffusion Model using styles or collections of styles, created by you or the public ones. You can see the collections and styles properties in the Collections Properties and Styles Properties sections.

  • Name
    steps
    Type
    number
    Description

    Number of training steps (minimum: 500; maximum: 5000).

  • Name
    metadata
    Type
    JSON
    Description

    You can add metadata info about your Fine-Tune, like user_id, and other information you want to include to integrate it with your system.

Request

POST
/v1/finetunes
  curl --request POST \
    --url https://api.bodia.ai/v1/finetunes \  
    --header 'Authorization: Bearer {API_KEY}' \
    --data '{
      "title": "Fine-Tune Title",
      "name": "car",
      "images_url": [
      "https://via.placeholder.com/512x512.jpg",
      "https://via.placeholder.com/512x512.jpg",
      "https://via.placeholder.com/512x512.jpg",
      "https://via.placeholder.com/512x512.jpg"
    ],
    metadata: {
      "user_id": "example_id"
    },
    "prompts": [{
      "prompt": "A car on the route 99 road",
      "negative_prompt": "stones",
      "cfg": 7.5,
      "steps": 35,
      "seed": 2323,
      "high_resolution": true,
      "aspect_ratio": "square",
      "metadata": {
        "info": "example info I want to include"
      }
    },{
      "prompt": "A mediterranean portrait of a car driving in the mediterranean sea"
    }],
    "styles":[{
      "id": "YF1xORgvKIbHy-LeF1vvWYDp",
      "aspect_ratio": "portrait",
      "high_resolution": true
    }]
  }'

Response

{
  "id": "WAz8eIbvDR60rouK",
  "title": "Training 1",      
  "images_url": [
    "https://via.placeholder.com/512x512.jpg",
    "https://via.placeholder.com/512x512.jpg",
    "https://via.placeholder.com/512x512.jpg",
    "https://via.placeholder.com/512x512.jpg"
  ],      
  "metadata": {
      "user_id": "example_id"
  },
  "steps": 2000,
  "created_at": "2023-02-08T22:14:03.800Z",
  "name": "car",
  "token": "zwx",
  "model": "sd1.5"
}

GET/v1/finetunes

List Fine-Tunes

GET request to the Fine-Tunes endpoint to retrieve a list of all your fine tunes.

Request

GET
/v1/finetunes
curl -G https://api.bodia.ai/v1/finetunes \
  -H "Authorization: Bearer {API_KEY}"

Response

[
  {
    "id": "WAz8eIbvDR60rouK",
    "title": "Car Fine-Tune",
    "name": "car",
    "token": "zwx",
    "error_message": null,
    "metadata": null,
    "images_url": [
      "https://via.placeholder.com/512x512.jpg",
      "https://via.placeholder.com/512x512.jpg",
      "https://via.placeholder.com/512x512.jpg",
      "https://via.placeholder.com/512x512.jpg"
    ],        
    "steps": 2000,
    "created_at": "2023-01-31T15:16:39.959Z",
    "model": "sd1.5"       
  }
]

GET/v1/finetunes/:id

Retrieve a Fine-Tune

This endpoint allows you to retrieve a Fine-Tune by providing their ID. Refer to Fine-Tune Model Properties to see which properties are included with Fine-Tune objects.

Request

GET
/v1/finetunes/:id
curl -G https://api.bodia.ai/v1/finetunes/{TUNE_ID} \
  -H "Authorization: Bearer {API_KEY}"

Response

{
  "id": "WAz8eIbvDR60rouK",
  "title": "Car Fine-Tune",
  "name": "car",
  "token": "zwx",
  "images_url": [
      "https://via.placeholder.com/512x512.jpg",
      "https://via.placeholder.com/512x512.jpg",
      "https://via.placeholder.com/512x512.jpg",
      "https://via.placeholder.com/512x512.jpg"
  ],   
  "error_message": null,
  "metadata": null,      
  "steps": 2000,
  "created_at": "2023-01-31T15:16:39.959Z",  
  "model": "sd1.5"     
}

DELETE/v1/finetunes/:id

Delete a Fine-Tune and its Prompts

This endpoint allows you to delete Fine-Tunes in Bodia.

Note: This will also delete the Prompts of that Fine-Tune and the model.

Request

DELETE
/v1/finetunes/:id
curl -X DELETE https://api.bodia.ai/v1/finetunes/{TUNE_ID} \
  -H "Authorization: Bearer {API_KEY}"

Response

{
  "delete": "it has been deleted successfully"
}