> For the complete documentation index, see [llms.txt](https://docs-origin.anvil.bot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-origin.anvil.bot/user-guides/training-a-model.md).

# Training a Model

Train and finetune state-of-the-art robot policies

## Get the repository

{% embed url="<https://github.com/anvil-robotics/anvil-embodied-ai>" %}

{% hint style="info" %}
Anvil's embodied AI SDK is in early beta. We will be improving reliability and adding support for new models and workflows soon.
{% endhint %}

### Requirements

* Python 3.12+
* [uv](https://docs.astral.sh/uv/getting-started/installation/)
* [ffmpeg](https://www.ffmpeg.org/)

## Set up environment

```bash
uv sync --all-packages
```

## Convert data to train-ready format

Anvil uses the standard `LeRobotDataset v3.0` for training, and so the recorded Anvil `MCAP` must be converted before training. To do this, Anvil provides the `mcap_converter` package, which will go through your recorded data and compile the episodes into a single `LeRobotDataset` that's ready for training:

```bash
uv run mcap-convert --input-dir data/raw/take-apart-legos --output-dir data/datasets/legos --config configs/mcap_converter/openarm_bimanual_quest.yaml
```

## Train

Anvil also leverages `LeRobot` for training support, and wraps it for convenience with our `lerobot_training` package, that makes it easy to use with Anvil data.

```bash
uv run anvil-trainer --dataset.root=data/datasets/legos --policy.type=act
```

Additional information on Anvil's model training software can be found in the Github Readme.&#x20;

## Next Steps&#x20;

Once your model is trained learn how to [Deploy a Model](/user-guides/deploying-a-model.md).&#x20;
