context deadline exceeded error, and the artifact list is not designed for deleting hundreds of versions.
The following script deletes all artifact versions of a specified type in a project.
Replace the [YOUR-TEAM] and [YOUR-PROJECT] placeholders with your own values. Use your team or username for [YOUR-TEAM], not your organization name.
wandb.Api.artifact_collections() returns both source collections and link collections:
- A source collection contains artifact versions logged to runs in the project.
- A link collection contains references to artifact versions linked to another collection, such as a collection in a registry.
version.delete(delete_aliases=True) removes only the link. The source artifact and its files stay where they are, so that version frees no storage.
Reclaim the space
Deleted artifacts are soft-deleted first, then removed during garbage collection, so your storage usage doesn’t drop immediately. For the timing and how to verify your usage, see Why doesn’t my storage usage update after deleting runs? and Delete an artifact.Artifacts Storage Python API