I can update the aliases of an artifact that is not linked to a registered model in the following manner:
api = wandb.Api()
artifact = api.artifact('entity/project/artifact:v1')
# Add an alias
artifact.aliases.append('test')
# Persist all artifact modifications
artifact.save()
However, I cannot update an artifact linked to a registered model/collection.
api = wandb.Api()
artifact = api.artifact('entity/project/collection:v1')
# Add an alias
artifact.aliases.append('test')
# Persist all artifact modifications
artifact.save()
Error:
File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.wandb.ai/graphql
The only way to do it is by using the UI and manually adding an alias.
Is there a way to programmatically update the alias of an artifact in a collection/registered model?