Install and initialize the ValidMind Library

Published

November 20, 2024

ValidMind generates a unique code snippet for each registered model to connect with your developer environment. You initialize the ValidMind Library with this code snippet, ensuring that your documentation and tests are uploaded to the correct model.

Prerequisites

In order to integrate the library and to be able to upload to the platform, you must provide the following information through a code snippet that you copy from the ValidMind Platform:

Argument Description
api_host The location of the ValidMind API
api_key The account API key
api_secret The account secret key
model The model identifier

If you do not have a suitable model with a code snippet to use, you can register a model first.2

The library also requires access to the data sources where data sets used for training, testing, and trained model files are stored. This access is needed to run model documentation and validation tests, and to upload to the platform to populate the model documentation and validation reports.

Install ValidMind

Locate the library integration instructions

For existing models, this information can be found in the ValidMind Platform:

  1. In the left sidebar, click Model Inventory.

  2. Select a model by clicking on it or find your model by applying a filter or searching for it.3

  3. In the left sidebar that appears for your model, click Getting Started.

  4. Locate the code snippet and click Copy snippet to clipboard.

Install the library

To install the library:

%pip install validmind

Initialize the library

To initialize the library, paste the code snippet with the client integration details directly into your development source code, replacing this example with your own:

import validmind as vm

vm.init(
  api_host = "https://API_HOST.validmind.ai/api/v1/tracking",
  api_key = "API_KEY",
  api_secret = "API_SECRET",
  model = "MODEL_IDENTIFIER"
)

To also enable monitoring, add monitoring=True to the vm.init method in your code snippet. 4

After you have pasted the code snippet into your development source code and run your code, the ValidMind Library will connect and register with the ValidMind Platform. You can now use the library to document and test your models, and to upload model documentation and test results to the platform.

Upgrade ValidMind

After installing ValidMind,5 you’ll want to periodically make sure you are on the latest version to access any new features and other enhancements:

  1. In your Jupyter Notebook or developer environment, retrieve the information for the currently installed version of ValidMind:

    %pip show validmind

Example output:

Name: validmind
Version: 2.5.15
...
  1. If the version returned is lower than the version indicated in our production open-source code,6 run the following command:

    %pip install --upgrade validmind
Current version:

v2.5.19