How to save/restore model using artifact on servers that do not have internet access?

Hi,

I just started using wandb tools. According to the instruction here, it suggests using Artifact for new code to save models. And I am able to save the model in the offline mode. However, I wonder how to restore the model from an artifact with a particular version (e.g., v3, not necessarily the latest version of the artifact) if I want to resume the training after it’s interrupted?

I am running code on compute nodes that do not have access to internet, so I have to use the offline mode. And in offline mode, I cannot run use_artifact command as it only works in online mode. However, I think all the artifact data is already saved locally using log_artifact command. So in theory, I should be able to restore a particular version of the artifact? How can I get that? Even though I know the model file location, it is the latest model file, not a particular history version of the model file (that’s the point of using Artifact to track the model?).

    run = wandb.init(mode='offline', project='test')
    artifact = run.use_artifact('hello-world:v3')
    artifact_dir = artifact.download(root=run.dir)

Hey Tao,

checking on this for you.

Best,
Arman

@armanharutyunyan Hi Arman, did you find a solution by any chance? Thanks.

Hey Tao, sorry about the delay on this. The offline run will be logged within your wandb folder that gets generated. You can access the run given the run_id by constructing the path and accessing the files within the directory. Other than that there is no way to access offline runs