> For the complete documentation index, see [llms.txt](https://guide.petoi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.petoi.com/extensible-modules/petoi-ai-vision-module/custom-petoi-vision-model/steps-on-how-to-get-started/step-2-train-model/train-model-on-google-colab.md).

# Train model on Google Colab

Welcome to Google Colab! This is where we rent a powerful cloud computer from Google for free to train our AI.

Colab notebooks run code in "blocks" or "cells." To train your model, you do not need to write any code from scratch, you just need to run the blocks in the correct order by clicking the Play button next to each one.

Work from top to bottom. Wait for each cell to finish before running the next one.

### Training workflow

{% stepper %}
{% step %}

## Run the Setup

Start at the top of the notebook and click "Play" on the introductory cells to set up your cloud computer.

* Action: Run the Testing Dataset cells.
* Skip: Do *not* run the "Local train setup (Advanced)" section. That is only for people running this on their home computers!

{% hint style="info" %}
The local training section requires a computer-based setup. Skip it when using Google Colab.
{% endhint %}
{% endstep %}

{% step %}

## Load Your Dataset

Tell the AI where to find the images you chose in Step 1. You only need to run the section that matches your dataset!

* Action: If you downloaded from Roboflow, run only the cells under ROBOFLOW DATASET.
* Action: If you downloaded from Kaggle, run only the cells under KAGGLE DATASET.

{% hint style="warning" %}
Run one dataset section only. Running both can overwrite or mix your training data.
{% endhint %}
{% endstep %}

{% step %}

## Start the Training

This is the main event!

* Action: Scroll down to the Training process section and click Play.
* Wait: The code will start running, and you will see numbers scrolling on your screen as the AI studies your images. Leave this tab open and do not close your browser! This can take anywhere from 10 minutes to an hour.

{% hint style="info" %}
Training time depends on your dataset size and the available Colab hardware.
{% endhint %}
{% endstep %}

{% step %}

## Export and Download

Once the training cell finishes running, you need to save your new AI so you can use it in the real world.

* Action: Run the Export Model cell to package the AI.
* Action: Run the Quantize and download cell. This compresses your model so it runs super fast on small hardware, and it will automatically download the final file directly to your computer.

{% hint style="success" %}
You are ready to deploy when the optimized model file downloads to your computer.
{% endhint %}
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://guide.petoi.com/extensible-modules/petoi-ai-vision-module/custom-petoi-vision-model/steps-on-how-to-get-started/step-2-train-model/train-model-on-google-colab.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
