If you are using the watsonx.governance service, learn how to track and govern an AI asset, such as a machine learning model or a foundation model asset, in a notebook.
The sample code demonstrates how to register and track a machine learning model.
Tracking an AI asset
Copy link to section
If your model is in a notebook, you can insert code to register the model with an AI use case.
Create a use case:
model_usecase_catalog_id = "b54179b3-d6f9-4886-bd48-a248c60d1f36"# Specify the catalog to store the use case
model_usecase_name="model_usecase_name_here"
model_usecase_desc="model usecase for data here"
model_usecase = facts_client.assets.create_model_usecase(catalog_id=model_usecase_catalog_id,name=model_usecase_name,description=model_usecase_desc)
model_usecase.get_info(True)
Copy to clipboardCopied to clipboard
Create an approach in the use case:
name_approach = model_usecase.create_approach(name="nameapproach",description="approach for data here")
name_approach.get_info()
wml_model = facts_client.assets.get_model(model_id="your model id ",container_type="project",container_id="container id")## model id is the auto ai model id
wml_model.track(model_usecase=model_usecase,approach=name_approach,version_number="major",version_comment="name model major version")
Copy to clipboardCopied to clipboard
Tracking a prompt template programmatically
Copy link to section
Consider these requirement for tracking prompt templates for governance programmatically:
Make sure an equivalent local deployment of the same foundation is available in the new container.
Use Factsheets SDK to untrack and unlock the prompt template asset.
Use watsonx.ai SDK or watsonx.ai APIs to change the foundation model to a new, local deployment, which will update the MRN. The model identity is preserved after this MRN update; that is, the resource_key hash remains the same.
Use Factsheets SDK to retrack the prompt remplate asset under the same AI use case and approach.
About cookies on this siteOur websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising.For more information, please review your cookie preferences options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.