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

# TRAIN A MODEL

> Upload a dataset and train a model

Requires an authenticated session with an active project. See the [quickstart guide](/cli/quickstart) for more info.

This example uses the [banking77 example dataset](https://huggingface.co/datasets/oumi-ai/banking77-oumi-quickstart/resolve/main/banking77_train_basic.jsonl?download=true).

<Steps>
  <Step title="Upload the training data">
    ```bash theme={null}
    oumi-cli datasets upload ./banking77_train_basic.jsonl --display-name "banking77-train"
    ```

    <Note>Data must be in JSONL format. Add `--dry-run` to verify compatibility and view metadata without uploading.</Note>
    Note the dataset ID it returns.
  </Step>

  <Step title="Write a recipe json">
    Set `DATASET_ID` to the ID from the previous step, then paste the whole block (lora finetunes Qwen3-8b on the banking 77 dataset):

    ```bash theme={null}
    DATASET_ID=1

    cat > recipe.json <<EOF
    {
      "displayName": "banking77-intent-classifier",
      "recipeConfig": {
        "type": "train",
        "trainingConfig": {
          "model": { "modelName": "Qwen/Qwen3-8B" },
          "data": { "train": { "datasets": [{ "datasetId": $DATASET_ID }] } },
          "peft": { "peftMethod": "lora" }
        }
      }
    }
    EOF
    ```
  </Step>

  <Step title="Create the recipe">
    ```bash theme={null}
    oumi-cli recipes create --type training --input-json-file recipe.json
    ```

    Returns the recipe ID you pass to `train`.
  </Step>

  <Step title="Launch the run">
    <Note>Training is a long running operation which can take 1hr+ depending on the datatset and model. Billing charges apply. For more info see our [pricing page](https://oumi.ai/pricing).</Note>

    ```bash theme={null}
    oumi-cli models train --name banking77-intent-classifier --recipe <RECIPE_ID>
    ```

    Blocks until training finishes, then prints the model ID, model version ID, and operation ID.
  </Step>
</Steps>

The model weights can be exported with the following command. (Note that model exports require a pro plan and are limited to 1 per month):

```bash theme={null}
oumi-cli models download <MODEL_ID> --out ./weights
```

## NEXT STEPS

<Columns cols={2}>
  <Card title="Evaluate a model" icon="chart-column" href="/cli/workflows/evaluate-a-model">
    Score it and find where it fails.
  </Card>

  <Card title="Deploy a model" icon="cloud" href="/cli/workflows/deploy-a-model">
    Serve it behind an inference endpoint.
  </Card>
</Columns>
