I would like to access the values in a 'run_table' type artifact without downloading the file

I have tried accessing the artifact in various ways, and I seem to get the artifact name, but then the artifact is not recognized as existing if I use wandb.use_artifact() or if I go through logged artifacts and try to access the table, the table does not exist. I’ve tried two ways:

for key, value in run.summary.items():
print(f"{key}: {value}")
if desired_string in key:
name = (see below for possible combinations of key and value)
wandb.init()
artifact = wandb.use_artifact(name) #I get an error here
table = artifact.get(name)
columns = table.get_column(‘columns’)
print(columns)

I’ve tried the following to get the name that will let me use the artifact and table :
name = key
name = value[‘path’]
name = ((value[‘path’].split(‘:’)[0]).split(‘/’)[-1]).split(‘.’)[0]
because the path had the format "media/table/given_file_name.table.json

I also tried stepping through the logged objects:
for artifact in run.logged_artifacts():
fname = artifact.name
ftype = artifact.type
if desired_string in fname and ftype == ‘run_table’:
name = fname
table = artifact.get(name)
columns = table.get_column(‘columns’) # get an error here because table is None
print(columns)

I have tried similar string operations as above to get the correct name for the table. I have also tried using the artifact ID instead of the name.

I have no problems downloading the file containing the table data and then processing it, but I would like to access the data directly without downloading. Please help.

Hi @snuss-warren , happy to look into this for you. You had mentioned running into an error when executing
artifact = wandb.use_artifact(name) , could you please provide details into what the error message is? As long as a project contains the artifact, you should be able to fetch it. Example for one of my projects.

import wandb
wandb.init(project="support")
artifact = wandb.use_artifact('mnist-preprocess:v0')

In terms of accessing the data directly or for example, downloading only a few files from an artifact. This isn’t currently an available feature but there is an active feature request out for this functionality.

Hi. Thanks for your help. I believe the error in the use_artifact command was “file not found” or similar, and I believe it must have been difference in the name I read compared to the actual file names. It would not surprise me if it had to do with the path. I unfortunately do not have the exact error and found another way to get the information.

In terms of accessing the data directly or for example, downloading only a few files from an artifact. This isn’t currently an available feature but there is an active feature request out for this functionality.

So what I really wanted to do is not possible. In that case, I have managed to access the needed files by downloading and I will continue to use that solution. I believe my issue is resolved.

Hi @snuss-warren , thank you for the update. I will add your details to the feature request ticket and keep you updated once there’s been movement on it’s implementation. If you are able to reproduce the errors you originally saw with your artifacts and would like to continue the conversation, please do response and we’ll take a close look. In the meantime I will mark the request resolved.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.