SummaryWriter.add_scalar() number format and Transforms.TensorboardX
See original GitHub issue1st Question : How can I control the number format of scalars in TensorboardX board in a graph?
Let’s
# proper imports writer = SummaryWriter()
x = 5.123456789
epoch = 3
If I write, writer.add_scalar( 'Raw integer scalar', x, epoch)
everything works fine, but the output format in TensorboardX it varies.
If I write, writer.add_scalar( 'Formatted raw integer scalar', '{:0.2%}'.format(x), epoch)
I get this kind of error
there is no workspace variable
from line 404, file tensorboardX/writer.py
if self._check_caffe2_blob(scalar_value):
scalar_value = workspace.FetchBlob(scalar_value)
and there is a check for a Caffe variable although I am using PyTorch.
2nd Question : How can I use TensorboardX from Transforms module, what are the dependencies and their minimum versions?
Thanks, Vassilis
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
Top GitHub Comments
This error is indeed triggered whenever a string is passed in as the second value of add_scalar. That’s because add_scalar expects scalars. That’s a perfectly natural assumption for tensorboardX to make. It would be better to throw a different error in this situation, but both my fundamental problem and the OP’s problem are not tensorboardX’s problem. I would politely suggest throwing a
TypeError
rather than leaving users thinking that they have a package installation problem when they see theNameError
.example code to trigger a NameError that probably ought to throw a TypeError
The specific invocation in transformers could be passing something that’s a string type, so this looks like the logic for whether it’s in caffe2 is falsely triggering. I think I can suggest a one line fix for this, but there might be a more elegant way. Specific logic in transformers triggering this issue for me is just a for loop over a dictionary’s items. https://github.com/huggingface/transformers/blob/02e5f79662d72cccdca81a47e3001a5f6d36e5b1/src/transformers/trainer.py#L556-L557