Setup of Jupyter Notebook
How to Setup Jupyter Notebook and run Credmark Models on it.
To run Credmark models, it is not necessary to run them in your SDK locally, you can as well simply run with Jupyter Notebooks.
Jupyter Notebook is a web-based interactive computing platform often used for data analysis. In this guide, we will
Set up a virtual environment using Conda
Clone Credmark-Models-Notebook repository
Open and run Jupyter Notebook in this environment
Clone the Credmark github repository in Jupyter Notebook
Run Credmark models in Jupyter Notebook
Click here for more information on installing Conda.
Setting up your Virtual Environment
Run the following script in your CLI. Note, you can change the variable NAME to use this script to create other Conda environments.
2. Your CLI should show the new environment in the command line.
Cloning the Credmark-Models-Notebook repository.
Navigate your CLI to the directory where you'd like to clone the repository. Clone the repository with
in the command line.
Open Jupyter Notebook and navigate to the examples
Open Jupyter Notebook with
in the command line.
When the notebook opens in your browser, you will see the Notebook Dashboard, which will show a list of the notebooks, files, and subdirectories in the directory where the notebook server was started. Most of the time, you will wish to start a notebook server in the highest level directory containing notebooks.
Now click on the example directory
And click 00-start.ipynb to open the notebook. Note that we have already completed the first few steps (creating a virtual environment and launching Jupyter Notebook).
Look to the upper right corner of the notebook to see which kernel the Jupyter Notebook is running.
Mine opens with the default Python 3 ipykernel, so I'll have to switch it to the conda environment we created for using the Credmark Model Framework in Jupyter Notebook. Do this by clicking the Kernel tab of the Notebook, and navigating to Change kernel. I'll switch from the default Python 3 (ipykernel) to the cmf conda environment.
Once the notebook switches kernels, you should see your chosen kernel in the upper right corner of the notebook.
Install Credmark Model Framework using Jupyter Notebook
Insert a new cell below the installation instructions and execute the following commands
Configure Model Directory and Chain to Provider URL
Use your Ethereum Web3 API key as your chain_to_provider_url
and be sure the model_loader_path
is pointing at the cloned credmark-models-py's "models" folder.
Follow along with the rest of this example notebook, and any others, to learn how to use the Credmark Model Framework within Jupyter Notebooks.
Last updated