Cannot use artifact when in offline mode

Hi,

How can I use artifacts without actually enabling wandb syncing? Sometimes I want just to play around my notebook without logging anything, but using data/models logged as artifacts in my project. I think I can do it via cli but I would like to know if there’s something I’m missing in the API.

Thanks!

Hello!

Here’s a copy pasta from the docs-faq, please lmk if this doesn’t answer your Q:

Can I run wandb offline?

If you’re training on an offline machine and want to upload your results to our servers afterwards, we have a feature for you!

  1. Set the environment variable WANDB_MODE=offline to save the metrics locally, no internet required.

  2. When you’re ready, run wandb init in your directory to set the project name.

  3. Run wandb sync YOUR_RUN_DIRECTORY to push the metrics to our cloud service and see your results in our hosted web app.

You can do something like this:

artifact =  wandb.Artifact(name="folds", type="dataset")
artifact.add_file('./df_train.csv')
artifact.add_file('./df_valid.csv')
1 Like

The thing is that I want to be online, but just to use/download artifacts, but not for logging anything. In other words, I want to be able to download from my project but not to upload.

You could try the following pseudocode:

  1. wandb.login()
  2. wandb.init()
  3. Download from Artifacts
  4. wandb.finish()
  5. set WANDB_MODE=offline
  6. do training

An alternative to 4 + 5 would be to turn on anonymous mode for your training, everything will be tracked and synced to a temporary anon account and not linked to your account

wandb.init(anonymous="allow")

2 Likes

Thanks! The anonymus mode could do the trick for me…however, I can’t udnerstand how it exactly works. I’m trying the colab notebook they provide, setting anonymous=must but it still creates a run linked to my account

hmmm ok, I guess maybe you have to log out…will forward that feedback. Maybe instead of anonymous you could use set the mode parameter to offline, or disabled then

Yes that’s what I used to do (mode=disabled) when my run does not use artifacts as input datasets. The problem is that with mode=disabled I cannot use artifacts