Segmind Docs
WebsiteConsole
  • Segmind Developer Platform
    • Developer Quickstart
    • Key Concepts
    • Support
    • Authentication
    • Pricing and Billing
    • Flux Fine Tuning
      • Flux fine Tuning API
      • Flux Pro fine tuning API
      • Fine tuning GPU options
    • Webhooks
    • Teams
    • Account and Developer Settings
  • API Reference
    • Model Status
    • Rate Limits
    • Account and Billing APIs
    • Premium models
    • Monitoring
    • Logging
    • Random Seed
  • PixelFlow
    • Getting Started
    • PixelFlow Components
    • PixelFlow Operations
    • Templates
    • Workflow to API
  • Model Hub
  • Dedicated Endpoints
    • Getting started
    • Endpoint APIs
Powered by GitBook
On this page
  • Base URL
  • Authentication
  • 1. Initiate Fine-Tune Request
  • 2. Get the List of Fine-Tune Requests
  • 3. Get Fine-Tune Data Upload Pre-Signed URL
  • 4. Update Fine-Tuned Model Access
  • Webhooks
  1. Segmind Developer Platform
  2. Flux Fine Tuning

Flux Pro fine tuning API

This documentation outlines the API endpoints for initiating and managing Flux Pro fine-tuning requests in Segmind.

Base URL

https://api.segmind.com

Authentication

All requests require an API key for authentication. Include the API key in the headers as follows:

--header 'x-api-key: YOUR_API_KEY'

1. Initiate Fine-Tune Request

Description

Initiate a new fine-tuning request.

Request

Headers

  • x-api-key: Your API key.

  • Content-Type: Should be application/json.

Body

The request body must be in JSON format. Here's an example:

curl --location 'https://api.segmind.com/finetune/request/submit' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "name": "fluxprotest",
    "data_source_path": "https://finetune-pipeline.s3.amazonaws.com/uploads/b15e76a9-0037-4fcf-8522-fdaab460e206/54c7783e-7ac4-437d-a449-89a2613f1dc8-1MAN-Man-Dec-2023.zip",
    "instance_prompt": "1MAN, running in brown suit",
    "trigger_word": "1MAN",
    "base_model": "FLUX_PRO",
    "theme": "GENERAL",
    "segmind_public": false,
    "advance_parameters": {
        "iterations": 300,
        "captioning": true,
        "priority": "QUALITY",
        "finetune_type": "FULL",
        "lora_rank": 32,
        "learning_rate": 0.005
    }
}'

Advanced Parameters:

  • theme: Determines the finetuning approach based on your concept Options: "CHARACTER", "PRODUCT", "STYLE", "GENERAL"

  • iterations  Minimum: 100  Default: 300  Purpose: Defines training duration.  For fast exploration 100-150 iterations can be enough.  For more complex concepts, larger datasets or extreme precision more iterations than the default can help

  • learning_rate   Default: 0.00001 if finetune_type is "FULL"   Default: 0.0001 if finetune_type is "LORA".

  • priority  Options: "SPEED", "QUALITY", "HIGH_RES_ONLY"  The speed priority will improve speed per training step  Default: "QUALITY"

  • captioning   Type: Boolean   Default: True   Purpose: Enables/disables automatic image captioning

  • trigger_word   Default: "TOK"   Purpose: Unique word/phrase that will be used in the captions, to reference the newly introduced concepts

  • lora_rank   Default: 32   Choose between 32 and 16. A lora_rank of 16 can increase training efficiency and decrease loading times.

  • finetune_type   Default: "FULL"   Choose between “FULL” for a full finetuning + post hoc extraction of the trained weights into a LoRA or “LORA” for a raw LoRA training

2. Get the List of Fine-Tune Requests

Description

Retrieve a list of fine-tuning requests along with their details.

Request

curl --location 'https://api.segmind.com/finetune/request/list' \
--header 'x-api-key: YOUR_API_KEY'

3. Get Fine-Tune Data Upload Pre-Signed URL

Description

Get a pre-signed URL for uploading fine-tuning data.

Request

curl --location --request GET 'https://api.segmind.com/finetune/request/upload/pre-signed-url' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "name": "NAME_OF_THE_FILE"
}'

4. Update Fine-Tuned Model Access

Description

Update the access settings of a fine-tuned model (public/private).

Request

curl --location --request PUT 'https://api.segmind.com/finetune/request/access-update' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'request_id="FINETUNE_REQUEST_ID"' \
--form 'segmind_public="True"'

Webhooks

Webhooks provide a way to get real-time updates about finetuning jobs programmatically. You can register a webhook for finetuning jobs in the Developer tab on console.

Once a webhook is created, test it, by having it send a sample payload to verify delivery. Once its up, create a finetuning job to receive status updates. Events are sent to webhooks on 3 status changes:

  1. TRAINING_COMPLETED : The training is completed on model, and finetuned model is available for download on the trained_model_url.

  2. INFERENCE_QUEUED: Model is being deployed on Segmind inference engine.

  3. AVAILABLE: Model is deployed, and ready for inferences on inference_api_url

Note: You can create only 1 webhook at a time for finetune jobs. If you want to change the webhook, please delete the old webhook before creating a new one.

PreviousFlux fine Tuning APINextFine tuning GPU options

Last updated 2 months ago