Hey community!
I’m working on a ML pipeline using Pytorch Lightning and W&B.
I’m trying to access model checkpoints that were pushed into W&B using lightning.pytorch.loggers.wandb.WandbLogger
. The checkpoints are correctly shown in the W&B web UI, as well as locally on the machine that was used for training.
When trying to access the model checkpoint similarly as instructed here and here using either the wandb.Api()
or lightning.pytorch.loggers.wandb.WandbLogger
, respectively, both cases result in a wandb.errors.CommError
, stating:
wandb.errors.CommError: It appears that you do not have permission to access the requested resource. Please reach out to the project owner to grant you access. If you have the correct permissions, verify that there are no issues with your networking setup.(Error 404: Not Found)
I’m working on a W&B team project, that was setup by our administrator, so I’m thinking whether there’s something in the permissions side that the admin has to set? I also tried accessing the checkpoint via wandb.init()
in offline-mode to prevent my trials from clogging our W&B project space, but downloading artifacts in offline mode doesn’t seem to be a thing.
Here’s an example code snippet:
#!/usr/bin/env python3
from lightning.pytorch.loggers import WandbLogger
import wandb
if __name__ == "__main__":
user = "<TEAM-NAME>" # Note, this is different to my W&B user name
project = "<PROJECT-NAME>"
run_name = "<RUN-NAME>"
alias = "<ALIAS>"
checkpoint_reference = f"{user}/{project}/{run_name}:{alias}"
## DOWNLOAD ARTIFACT
# use wandb.Api()
# https://docs.wandb.ai/ref/python/public-api/api
api = wandb.Api()
artifact = api.artifact(checkpoint_reference, type="model") # PERMISSION DENIED!
# use WandbLogger
# https://docs.wandb.ai/guides/integrations/lightning#model-checkpointing
wandb_logger = WandbLogger(project=project, save_dir="", offline=True)
wandb_logger.download_artifact(
checkpoint_reference, artifact_type="model"
) # PERMISSION DENIED!
# trial - use wandb.init()
# https://docs.wandb.ai/guides/integrations/lightning#model-checkpointing
run = wandb.init(mode="offline")
artifact = run.use_artifact(
checkpoint_reference,
type="model",
) # -> CAN'T ´run.use_artifact()´ IN OFFLINE MODE!
artifact_dir = artifact.download()