Is it possible to force upload of a newly created artifact without finishing the run?
See original GitHub issuewandb version: 10.0.9 Python: 3.6.12 OS: Win 10
The workflow of my work with artifacts looks like this: I’m uploading multiple versions of an artifact during DL training, and then at the end of the script, I want to get a version of this artifact with a certain label.
Like this:
import torch
import wandb
wandb.init(project='Test')
run = wandb.run
artifact_name = 'Test-checkpoint'
# Do something 0...
# v0
artifact = wandb.Artifact(artifact_name, type='checkpoint')
artifact.add_file('./wandb/artifacts/42wsedgy/checkpoint_0.pth')
run.log_artifact(artifact)
# Do something 1...
# v1
artifact = wandb.Artifact(artifact_name, type='checkpoint')
artifact.add_file('./wandb/artifacts/42wsedgy/checkpoint_1.pth')
run.log_artifact(artifact)
# Do something 2...
# v2
artifact = wandb.Artifact(artifact_name, type='checkpoint')
artifact.add_file('./wandb/artifacts/42wsedgy/checkpoint_3.pth')
run.log_artifact(artifact)
# run.finish() #### QUESTION is about this line -- any other way to force artifacts upload?
# Sometime later.. in another part of the system
# Now try to get the latest of that artifact
api = wandb.Api({'project': 'Test'})
artifact = api.artifact(name=artifact_name + ':latest', type='checkpoint')
# OR
# artifact = run.use_artifact(artifact_name + ':latest', type='checkpoint')
# OR
# artifact = run.use_artifact(artifact)
filepath = artifact.download()
print(filepath)
When I use run.finish(), the artifact that gets downloaded is the one expected: Test-checkpoint-v2
If I don’t want to finish the run and remove the line with run.finish(), I get different erroneous outcomes:
- the error
ValueError: Project maria_korosteleva/Test does not contain artifact: "Test-checkpoint:latest"(I guess when none of the versions got a chance to be uploaded) - If use
run.use_artifact(artifact)instead ofapi.artifact()to get artifact object, the error isValueError: Cannot call download on an artifact before it has been saved - Sometimes I just get the wrong version: e.g.
Test-checkpoint-v1instead ofTest-checkpoint-v2
So, is it possible to force upload artifacts versions so that I won’t have to finish the run to get the correct files?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Is it possible to force upload of a newly created artifact without ...
When run.finish is called we block your process while all artifacts finish downloading. We will eventually add a method for you to call...
Read more >Job artifacts - GitLab Docs
Jobs can output an archive of files and directories. This output is known as a job artifact. You can download job artifacts by...
Read more >Gitlab pipeline test stage to fail AND create artifacts anyway
I had the same question, but it's easily solved: You can use artifacts:when to upload artifacts on job failure or despite the failure....
Read more >Pipeline run sequence - Azure - Microsoft Learn
Logs can be downloaded once the pipeline has finished. Other items that the agent can upload include artifacts and test results.
Read more >7 Github Actions Tricks I Wish I Knew Before I Started
Not only that, it will also trigger for any push to the branch that is initiating the pull request. This is a good...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@ariG23498 oh, right, the suggested solutions helps in most cases, thanks!
Hey @maria-korosteleva Would you like to close the issue if the suggested solution helps you? 😄