wandb: Error when Adding an artifact to a finished run

wandb version: 10.0.9 Python version: 3.6.12 OS: Win10

I’m running some evaluation on the model after the run is finished and trying to upload the results as an artifact attached to this run.

I’m creating an artifact as described in the docs:

run = wandb.Api().run('maria_koristeleva/Test/<run_id>')
artifact = wandb.Artifact(name, type=type)
artifact.add_dir(path)
run.log_artifact(artifact)

But I’m getting an error:

wandb: Adding directory to artifact (D:\GK-Pattern-Data-Gen\nn_pred_data_1000_tee_200527-14-50-42_regen_200612-16-56-43201113-17-27-49)... Done. 2.1s
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\wandb\apis\normalize.py", line 24, in wrapper
    return func(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\wandb\apis\public.py", line 1264, in log_artifact
    "Only existing artifacts are accepted by this api. "
ValueError: Only existing artifacts are accepted by this api. Manually create one with `wandb artifacts put`

Is this use-case supported?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Yep, agreed this is confusing. We want to do the work to make this case actually work. In the mean time how does this sound?

You can only link existing artifacts to historic runs with this api. Call wandb.init(id="...", project="...", resume="allow") then wandb.run.log_artifact(...) to save this artifact to a previous run.

UPD: Looking at the discussion in issue #1371, I need to create a new run, upload an artifact, and then link the artifact to the old run. But may I request a better error message for this case?? It confusing, and leads me to the un-existing function…