Hey,
I’m trying to get the version of an artifact directly after logging my model (encoder) as an artifact to WandB.
Code:
artifact = wandb.Artifact('my_artifact_name', type='model')
artifact.add_file('/home/dezzardhd/encoder.pth')
wandb.log_artifact(artifact)
version = artifact.version
Logging works so far, but…
when trying to access the version of the artifact I get an error.
Error:
Traceback (most recent call last):
File "/home/moritz/PycharmProjects/bachelorarbeit/main.py", line 48, in <module>
train_setups.start_training_sessions(project=project)
File "/home/moritz/PycharmProjects/bachelorarbeit/train_setups.py", line 18, in start_training_sessions
model_pipeline(config, project=project)
File "/home/moritz/PycharmProjects/bachelorarbeit/learning.py", line 84, in model_pipeline
save_model(model_ae=model, model_encoder=model_encoder, model_decoder=model_decoder)
File "/home/moritz/PycharmProjects/bachelorarbeit/learning.py", line 124, in save_model
version = artifact_enc.version
File "/home/moritz/anaconda3/envs/bachelorarbeit/lib/python3.9/site-packages/wandb/sdk/wandb_artifacts.py", line 191, in version
return self._logged_artifact.version
File "/home/moritz/anaconda3/envs/bachelorarbeit/lib/python3.9/site-packages/wandb/sdk/wandb_run.py", line 2899, in version
return self._assert_instance().version
File "/home/moritz/anaconda3/envs/bachelorarbeit/lib/python3.9/site-packages/wandb/sdk/wandb_run.py", line 2871, in _assert_instance
raise ValueError(
ValueError: Must call wait() before accessing logged artifact properties
What should I do now?
For context:
I want to print out the version number with some other parameters so that I can easier start my evaluation process for certain runs.
Best regards
DezzardHD