Train model locally on Windows (Advanced)
Connect Google Colab to a local Jupyter runtime and GPU.
This setup is for advanced users. Use cloud training for the simpler workflow.
Train in Google Colab while keeping datasets, models, and outputs on your computer.
This workflow connects Colab to a local Jupyter server on Windows. It also uses a dedicated Python environment.
Install 64-bit Python 3.13 or earlier before starting. Use the same Python installation throughout.
Connect Colab to your computer
Install JupyterLab
Install JupyterLab from the Jupyter installation guide.
Fix a missing jupyter command
If PowerShell reports that jupyter is not recognized, add Python's Scripts folder to your user Path.
Press Windows, search for Environment Variables, then select Edit the system environment variables.
Select Environment Variables.
Under User variables, select Path → Edit → New.
Add your Python
Scriptspath. For example:C:\Users\<your-username>\AppData\Roaming\Python\Python313\ScriptsSelect OK in every dialog.
Close and reopen PowerShell.
Work with local files
Colab now uses your local runtime and storage. Your datasets, models, and training outputs remain on your local drive.
Create an empty project folder before training. This keeps generated files organized.
Colab’s Files pane may not immediately show local file changes. Use the local Jupyter URL to verify files and folders.
Open the project folder in Jupyter. It contains your datasets, models, charts, and training outputs.
Use 64-bit Python 3.12 or earlier. Download it from the Python website.
Locate the Petoi_Workspace folder.
Create and activate the virtual environment
Right-click the folder, then select Open in Terminal.
Create the environment. Replace 3.10 with your installed Python version.
Activate the environment:
If PowerShell blocks activation, run cmd. Then run the activation command again.
Install GPU dependencies
Update pip and install the Jupyter kernel:
Install PyTorch with CUDA:
Verify that PyTorch detects your GPU:
Continue only when the command returns True.
Register and select the kernel
Register the virtual environment as a Jupyter kernel:
In Colab, select the Python (Petoi Workspace) kernel. Reconnect to the local runtime if prompted.
If the connection resets, connect to the local runtime again.
Rerun the GPU check. It should show your GPU.
Before start training, remember to relocate your folder:
Install Ultralytics
Run this in a Colab cell after connecting to the local runtime:
Confirm that it is installed in the virtual environment:
The displayed path must contain venv\Lib\site-packages.
If the package is missing, activate the virtual environment and install it again.
Restart the Colab session after installing packages. Then reconnect to the local runtime.
Train with local files
Before training, confirm that the notebook uses your project folder. Training files save there.
If a restart changes the working folder, select the project folder again in Jupyter.
Export the final model
Windows does not support the required full_integer_quant export. Complete this final step in cloud training.
Exit the local environment before continuing in cloud training.
Upload the model to Colab by dragging it from the Files pane.
Continue with the cloud export steps by running the code block.
Run the remaining code blocks to complete the export.
The NPU must show 100% utilization during camera inference. Otherwise, verify the full_integer_quant export.
Last updated
