Get started in Jupyter Notebooks
Certifai toolkit can be installed for use with Jupyter notebooks in two ways.
Install the Certifai toolkit and create a conda environment in which to run the Certifai notebooks: See the section below Run the example notebooks
Install the Certifai toolkit in the context of an existing Jupyter notebook, without creating and running a separate conda environment: See the section below Install Certifai toolkit in an existing notebook environment
Run the example notebooks
Alert: Windows 10 Users
Before you run example notebooks, you must disable
QuickEdit Mode in your terminal window. Right click in the terminal window and uncheck the
QuickEdit Mode option.
If you do not disable this option, clicking off your terminal window and back into your terminal window will cause the window to freeze and you will not receive your scan results updates.
Certifai provides two sets of example notebooks:
- The Certifai Toolkit includes one example notebook in the
examples/notebooksdirectory. To run that example, see the Tutorial: Scan your own Model in a Notebook.
- The public cortex-certifai-examples repo contains a larger set of content to help you get started, like sample notebooks and tutorials.
The rest of this section describes how to run the example notebooks provided in the cortex-certifai-examples repo.
The cortex-certifai-examples repo is available as of toolkit v.1.2.14. If you are using an earlier version, all of the example notebooks are available directly from the toolkit. The instructions for using toolkit example notebooks can be found in the earlier versions of the documentation (via the toggle at the top right).
Follow the instruction provided on these pages to download, install, and create a conda environment in which to run Certifai sample notebooks provided in the toolkit:
Clone the cortex-certifai-examples repo:
- Open a terminal window and
cdto the folder where you would like to store the repo clone.
git clone https://github.com/CognitiveScale/cortex-certifai-examples.git
- From the repo window click Clone or Download and then click download .zip.
- Move the .zip from your downloads folder to a folder where you would like to keep it.
- Open a terminal window and
Activate your Certifai conda environment if it is not already activated.conda activate certifai
Change your directory to the folder of the notebook you want to run (see the Example Notebooks section below for descriptions of the available notebooks). For example:
From the Jupyter browser, open the notebook, then follow the steps to Run each cell.
Scan reports are saved by default at
/<repo-root>/<notebook-root>/reports/ at the root of where you are running the notebook from.
Install Certifai toolkit in an existing notebook environment
Follow the instruction provided on this page to download the Certifai toolkit then proceed using the instructions below:
Open a terminal or PowerShell window and set your context inside the root of the
Install the Certifai packages required for running scans in notebooks.
version+tagrequired in the following commands can be found in your
a. Install the Certifai Scanner.pip install packages/all/cortex-certifai-scanner-<version>-<tag>.zip
Example:pip install packages/all/cortex-certifai-scanner-1.3.1-32-g8c0f816e.zip
b. Install the Certifai common library.pip install packages/all/cortex-certifai-common-<version>-<tag>.zip
Example:pip install packages/all/cortex-certifai-common-1.3.1-32-g8c0f816e.zip
c. Install the Certifai engine for the python version you are using.pip install packages/python3.6/cortex-certifai-engine-<version>-<tag>.zip
ORpip install packages/python3.7/cortex-certifai-engine-<version>-<tag>.zip
ORpip install packages/python3.8/cortex-certifai-engine-<version>-<tag>.zip
(Optional) To run the example notebooks, install the python library:
matplotlib.pip install matplotlib
Verify your install by running
Start the Jupyter server.jupyter notebook
A file list is displayed in the JupyterLab browser.
Visualizing scan results
View the report visualizations in your local Console. With the example data and notebooks the following report directories are used (relative to the root of the cortex-certifai-examples local or the notebook depending on where you are running the notebook from.):
toolkit/examples/reports- a set of pre-generated example reports included in the toolkit
<repo-root>/<notebook-root>/reports- reports generated by running the notebooks in the cortex-certifai-examples repo.
certifai console <path-to-reports>
Check out some additional details about specifying the report path.