This led to the cluttering of my wandb workspace with a lot of large models, that I do not need.
Now to my question: Is there a way to delete all models that do not contain the best flag in the UI or connect to my workspace from a python script and do it from there?
Hi @marcs, you can iterate through your Artifacts in the project and delete models that do not contain the “best” aliases like this:
import wandb
project = "<entity/project_name>"
api = wandb.Api()
runs = api.runs(project)
for run in runs:
for art in run.logged_artifacts():
if "best" not in art.aliases:
print(art.name)
#art.delete(delete_aliases=True)
I’ve commented out the delete function so you can check and make sure that this is only going to delete artifacts you’d like before uncommenting the delete function.