question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Q] Model registry | How to list all model versions?

See original GitHub issue

Morning team, I am trying to get all the versions of a registered model, currently I am using such a loop:

for index in range(0, N):
  wandb.use_artifact(f"[[entity/]project/]registeredModelName:v{index}")

Is there a way I can get a list of all the available versions through the API?

Thanks in advance!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kayvane1commented, Nov 22, 2022

I can confirm this works for standalone Projects but doesn’t work for the model-registry. It doesn’t understand the model_type to be valid.

Within the original project where this model has been linked from, the command does work (with the same model type).

image

Screenshot 2022-11-22 at 12 25 07

Trace:

ValueError                                Traceback (most recent call last)
/databricks/python/lib/python3.8/site-packages/wandb/apis/normalize.py in wrapper(*args, **kwargs)
     24         try:
---> 25             return func(*args, **kwargs)
     26         except requests.HTTPError as err:

/databricks/python/lib/python3.8/site-packages/wandb/apis/public.py in artifact_versions(self, type_name, name, per_page)
    892         artifact_type = ArtifactType(self.client, entity, project, type_name)
--> 893         return artifact_type.collection(collection_name).versions(per_page=per_page)
    894 

/databricks/python/lib/python3.8/site-packages/wandb/apis/public.py in collection(self, name)
   3718     def collection(self, name):
-> 3719         return ArtifactCollection(
   3720             self.client, self.entity, self.project, name, self.type

/databricks/python/lib/python3.8/site-packages/wandb/apis/public.py in __init__(self, client, entity, project, name, type, attrs)
   3735         if self._attrs is None:
-> 3736             self.load()
   3737 

/databricks/python/lib/python3.8/site-packages/wandb/apis/public.py in load(self)
   3790         ):
-> 3791             raise ValueError("Could not find artifact type %s" % self.type)
   3792         self._attrs = response["project"]["artifactType"]["artifactSequence"]

ValueError: Could not find artifact type model

During handling of the above exception, another exception occurred:

CommError                                 Traceback (most recent call last)
<ipython-input-115-d4f262d7ee43> in <module>
      4 artifact_type = "model"
      5 
----> 6 artifact_vers = api.artifact_versions(artifact_type, 'util-co/model-registry/relationship-classification')
      7 
      8 for version in artifact_vers:

/databricks/python/lib/python3.8/site-packages/wandb/apis/normalize.py in wrapper(*args, **kwargs)
     59                 raise
     60             else:
---> 61                 raise CommError(message, err).with_traceback(sys.exc_info()[2])
     62 
     63     return wrapper

/databricks/python/lib/python3.8/site-packages/wandb/apis/normalize.py in wrapper(*args, **kwargs)
     23         message = "Whoa, you found a bug."
     24         try:
---> 25             return func(*args, **kwargs)
     26         except requests.HTTPError as err:
     27             raise CommError(err.response, err)

/databricks/python/lib/python3.8/site-packages/wandb/apis/public.py in artifact_versions(self, type_name, name, per_page)
    891         entity, project, collection_name = self._parse_artifact_path(name)
    892         artifact_type = ArtifactType(self.client, entity, project, type_name)
--> 893         return artifact_type.collection(collection_name).versions(per_page=per_page)
    894 
    895     @normalize_exceptions

/databricks/python/lib/python3.8/site-packages/wandb/apis/public.py in collection(self, name)
   3717 
   3718     def collection(self, name):
-> 3719         return ArtifactCollection(
   3720             self.client, self.entity, self.project, name, self.type
   3721         )

/databricks/python/lib/python3.8/site-packages/wandb/apis/public.py in __init__(self, client, entity, project, name, type, attrs)
   3734         self._attrs = attrs
   3735         if self._attrs is None:
-> 3736             self.load()
   3737 
   3738     @property

/databricks/python/lib/python3.8/site-packages/wandb/apis/public.py in load(self)
   3789             or response["project"]["artifactType"].get("artifactSequence") is None
   3790         ):
-> 3791             raise ValueError("Could not find artifact type %s" % self.type)
   3792         self._attrs = response["project"]["artifactType"]["artifactSequence"]
   3793         return self._attrs

CommError: Could not find artifact type model

0reactions
VirginieBfdcommented, Oct 26, 2022

No problem, I haven’t had the time to go back to it. Thanks @ramit-wandb

Read more comments on GitHub >

github_iconTop Results From Across the Web

Model versioning with Vertex AI Model Registry - Google Cloud
In the Google Cloud console, go to the Model Registry page. Go to Model Registry · Under the Name column, select the name...
Read more >
Model registry - neptune.ai
Have all your production-ready models in a centralized model repository. Register, version, review and share them easily.
Read more >
Model Management - Documentation - Weights & Biases
Use the W&B Model Registry as a central system of record for models. Create Registered Models to organize your best model versions for...
Read more >
Version your Machine Learning models with MLflow
In the Models section, you'll find all models that you have registered. By selecting one of them, tree_model in this example, you'll see...
Read more >
Manage model lifecycle | Databricks on AWS
To display the list of available model stages and your available options, in a model version page, click the drop down next to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found