Passing a numpy array with a single value to wandb.config will convert it to a string
See original GitHub issue- Weights and Biases version: 0.9.4
- Python version: 3.6.9
- Operating System: Linux
Description
I was trying to pass a numpy array with a single value to wandb.config
,
and was surprised that it’s automatically converted to a str
.
However, I am not quite sure whether it’s a bug or not, feel free to close this if it’s intentional.
What I Did
wandb.config.testing = np.array([2. ], dtype=np.float32)
print(wandb.config.testing, type(wandb.config.testing))
will output:
2.0 <class 'str'>
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Configure Experiments with wandb.config - Documentation
You can pass in the arguments returned by argparse . This is convenient for quickly testing different hyperparameter values from the command line....
Read more >Log Data with wandb.log - Documentation - Weights & Biases
log() with a different value for step than the previous one, W&B will write all the collected keys and values to the history,...
Read more >wandb.data_types.Video - Documentation
(numpy array, string, io) Video can be initialized with a path to a file or an io object. The format must be "gif",...
Read more >wandb.data_types.Object3D - Documentation
data_or_path. (numpy array, string, io) Object3D can be initialized from a file or a numpy array. You can pass a path to a...
Read more >Log Media & Objects - Documentation - Weights & Biases
Images can be logged directly from numpy arrays, as PIL images, ... a dictionary with the following keys and values to the masks...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @Al-Murphy, That’s really interesting. I was able to get the same results as you and it was independent of Python version. I’ll let engineering know the bug is related to calling
wandb.init()
Thank you for helping trace it to back to the source.
As a work around, NumPy can parse a list of strings to a numpy array of floats so I would recommend calling np.array() if you use the config variable later in your code until we can address the bug.
Thank you again for bringing this to our attention, Nate
Hey @nate-wandb,
So I’ve noticed some very strange behaviour - on a new, empty notebook the array isn’t converted to a str:
And also on my current notebook, if I restart the kernel and run just the lines you sent me, again there is no issue. Only when I run my actual code first does an issue appear that it’s converted to a str. I then found what’s causing the issue through process of elimination and it turns out its:
Once I run this and the commands you posted (on either notebook), I get the following:
Are you aware of this causing an issue? Just to note when I run the
wandb.init
I do get the following warning: