Notebook Examples Guide¶
The MLTK Tutorials and API Examples are implemented in a Jupyter Notebooks. A Notebook allows for Markdown documentation with inline, executable Python code.
This describes how to run the a Notebook locally in VSCode or remotely on Google Colab
VSCode Notebooks¶
VSCode allows for running Notebooks locally on your PC.
Refer to the official VS Code Notebook documentation for getting started.
To run an MLTK example or tutorial notebook in VSCode:
Open VSCode
Select a Python Interpreter
This can be any supported Python Interpreter (Python 3.9, 3.10, 3.11, or 3.12), however, it’s recommended to create a Python “virtual environment” for installing the MLTK.
See the Installation Guide for more details.
To select the Python Interpreter open the VSCode “Command Palette” (Ctrl+Shift+P
), and enter: Python: Select Interpreter
Then find/enter the path to the Python executable you want to use.Open an MLTK example or tutorial (file extension
.ipynb
) in VSCodePress the Select Kernel button on the upper-right and select the Python Interpreter from step 2
Run an executable cell in the Notebook
The first time you run a cell, you may be prompted to Install ipykernel Click “Install” to install the package.
You should now be able to fully execute the examples and tutorials from the VSCode notebook environment
Google Colab¶
Google Colab is a free service provided by Google that allows for leveraging the Google cloud servers and GPUs for training your model.
NOTE: When running on Colab, the MLTK executes on the remote Google servers. As such, some commands that require local access are not supported.
To run an MLTK example or tutorial in Colab:
Create a Google Account (if necessary)
Go to the Google Signup page.
NOTE: Click the Use my current email address instead button to use your existing email instead of creating a gmail email address.Select the example or tutorial you want to run, and click the button at the top of the example or tutorial
At this point, you should be able to execute the example or tutorial on Colab
NOTE: Be sure to first install the MLTK via pip!pip install silabs-mltk
, all the examples/tutorials have this code at the top
NOTE: When training a model a Google Colab, be sure to first select the GPU hardware accelerator: