Skip to main content

End-to-End Fine-Tuning of a Text Generation Model

This page walks through a complete fine-tuning run using the HTTP API and curl, mirroring the minimal Python example you provided. You will:
  • Create a fine-tune
  • Start the fine-tune run
  • Monitor the fine-tune until it completes
All calls are made against a specific repository, similar to this Python snippet:
  • NAMESPACE = "Tutorials"
  • REPO = "FinancialSentiment"

Prerequisites

  • Repository on Oxen with your training data committed, for example:
    • Namespace: Tutorials
    • Repository: FinancialSentiment
  • Dataset resource inside that repo, for example:
  • API key with access to the repo:
    • Exported as OXEN_API_KEY
  • Base URL for the Oxen API:
    • Local dev example: https://hub.oxen.ai
    • Exported as OXEN_BASE_URL (optional, defaults shown below)
You can set these in your shell:
For the examples below, we will use:
  • resource: main/train_financial_sentiment.parquet
  • base_model: Qwen/Qwen3-0.6B
  • script_type: text_generation
Training parameters mirror the Python example:
  • question_column: text
  • answer_column: sentiment
  • epochs: 1
  • batch_size: 1
  • learning_rate: 0.0001
  • grad_accum: 1
  • lora_alpha: 16
  • lora_rank: 16
  • seq_length: 1024
  • logging_steps: 10
  • enable_thinking: false
  • neftune_noise_alpha: 0.0
  • save_steps_ratio: 0.25
  • save_strategy: epoch
  • use_lora: true

Step 1 – Create a Fine-Tune

Endpoint
  • POST /api/repos/{owner}/{repo}/fine_tunes
Example curl request (mirrors the Python payload):
The response will include a fine_tune object. For example:
Save the id (for example ft_12345) for the next steps. If you have jq installed, you can capture it directly:

Step 2 – Start the Fine-Tune Run

Once you have a fine_tune.id, trigger the run. Endpoint
  • POST /api/repos/{owner}/{repo}/fine_tunes/{fine_tune_id}/actions/run
Example curl request:
This mirrors the Python example:

Step 3 – Monitor Fine-Tune Status

You can poll the fine-tune to see when it completes. Endpoint
  • GET /api/repos/{owner}/{repo}/fine_tunes/{fine_tune_id}
Example curl loop (bash):
This shell loop is the curl equivalent of the Python monitoring loop:

With these three steps, you have a complete end-to-end fine-tuning run using only curl, matching the minimal Python example but fully scriptable from the command line.