Skip to content

5. Run in Colab Notebook

Jing Jin edited this page May 15, 2024 · 15 revisions

Model Explorer can be used directly in a Google Colab Notebook to visualize models accessible within its runtime. Check out the quick start Colab.

colab

Installation

!pip install ai-edge-model-explorer

For a faster installation, run the following command. It skips the installation of most of the dependency packages which are already included in the default Colab runtime.

!pip install --no-deps ai-edge-model-explorer-adapter ai-edge-model-explorer

Note

If you use the Colab local runtime, make sure to start it on supported platforms (macOS, Linux, or WSL on Windows)

Run

You can use the same APIs described in the API Guide. For example:

import model_explorer

model_explorer.visualize('/path/to/model')

After running the cell, Model Explorer will be displayed in an iFrame embedded in a new cell. You can use the colab_height parameter to control the height of the UI. In Chrome, the UI will also show an "Open in new tab" button that you can click to show the UI in a separate tab.

Important

Model Explorer UI elements are saved in your notebook but require the generating cell to be re-executed each session to function. Always re-run the relevant cell when reopening the notebook.

Note

Jupyter Notebook is not supported.

Clone this wiki locally