Capture code versions and model dependencies

Capture code versions

You can log and track the exact version of the model code of Registered Model Version.

  • If a model is registered via experiment run, the code version logged will automatocally be synced in model registry

  • If you are directly registering a model, you can log code version by capturing metadata about the git commit with the specified branch, tag, or commit_hash.

Here is the example to automatically capture git commit information:

#log code versions during model registration

from verta import Client
from verta.code import Git

HOST = "XXXX.XXXX.verta.ai"
client = Client(HOST)

model_version = client.create_registered_model().create_version()

demo_model_code = Git()

model_version.log_code_version("demo model code", demo_model_code)

Here is the example to manually provide git commit information if Verta system does not have access to git:

#Model training
#log code versions during model registration (manually)

from verta import Client
from verta.code import Git

HOST = "XXXX.XXXX.verta.ai"
client = Client(HOST)

model_version = client.create_registered_model().create_version()

demo_model_code = Git(
    repo_url="git@github.com:VertaAI/models.git",
    commit_hash="52f3d22",
    autocapture=False,
)

model_version.log_code_version("demo model code", demo_model_code)

Capture OS level dependencies

Capturing OS level dependencies are helpful in the following scenario:

  • If you have a python dependency that requires a specific package to be installed on the image to build or to run (e.g. GCC)

  • If you need a specific version of a package that for python dependency and python doesn't have a way to specify OS-level dependencies

Here is the example to capture OS level dependencies (e.g. for computer vision models):

#capture os dependencies during model registration

from verta import Client
from verta.environment import Python

HOST = "XXXX.XXXX.verta.ai"
client = Client(HOST)

model_version.log_environment(
     Python(
        requirements=["tensorflow"],
        apt_packages=["python3-opencv"],
    ),
    overwrite=True
)

Last updated