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

# train • AI Agents Framework

> This script finetunes a model using Unsloth's fast training framework.

# train

<Badge color="purple">AI Agents Framework</Badge>

This script finetunes a model using Unsloth's fast training framework.
It supports both ShareGPT and Alpaca‑style datasets by converting raw conversation
data into plain-text prompts using a chat template, then pre‑tokenizing the prompts.
Extra debug logging is added to help trace the root cause of errors.

## Import

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai import train
```

## Classes

<CardGroup cols={2}>
  <Card title="TrainModel" icon="brackets-curly" href="../classes/TrainModel">
    Class definition.
  </Card>
</CardGroup>

## Functions

<CardGroup cols={2}>
  <Card title="formatting_prompts_func()" icon="function" href="../functions/formatting_prompts_func">
    Converts each example's conversation into a single plain-text prompt.
  </Card>

  <Card title="tokenize_function()" icon="function" href="../functions/tokenize_function">
    Tokenizes a batch of text prompts with padding and truncation enabled.
  </Card>

  <Card title="main()" icon="function" href="../functions/main">
    Function definition.
  </Card>
</CardGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Agent Train" icon="dumbbell" href="/docs/concepts/agent-train" />

  <Card title="Training" icon="chart-line" href="/docs/train" />
</CardGroup>
