Hey all,
Here’s a minimal example of how to delete models that have no tag.
This is useful when you blow your data limit by saving too many intermediate checkpoints during training.
If you improve this script, post your improvements to this thread for the benefit of all.
Peace
Duane
import wandb
"""
deletes all models that do not have a tag attached
by default this means wandb will delete all but the "latest" or "best" models
set dry_run == False to delete...
"""
dry_run = True
api = wandb.Api(overrides={"project": "oardm_binary_mnist", "entity": "duanenielsen"})
project = api.project('oardm_binary_mnist')
for artifact_type in project.artifacts_types():
for artifact_collection in artifact_type.collections():
for version in api.artifact_versions(artifact_type.type, artifact_collection.name):
if artifact_type.type == 'model':
if len(version.aliases) > 0:
# print out the name of the one we are keeping
print(f'KEEPING {version.name}')
else:
print(f'DELETING {version.name}')
if not dry_run:
version.delete()