Workspace Clutterd with useless Artifacts

Hi There,

I unfortunately set the log model flag to “all” instead in a sweep of experiments.

    wandb_logger = WandbLogger(
        project="ProjectName",
        log_model="all",
        name="run_name",
    )

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?

Thank you :slight_smile:

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.