tensorboardX
tensorboardX copied to clipboard
AttributeError: 'NoneType' object has no attribute 'get_logdir'
Describe the bug When I was using tensorboardX in pytorch to record hyper parameters, I got the error as the title described.
Minimal runnable code to reproduce the behavior
import tensorboardX
writer = tensorboardX.SummaryWriter()
hparams = {'batch_size': args.batch_size,
'lr': args.lr,
'momentum': args.momentum,
'weight_decay': args.weight_decay}
writer.add_hparams(hparams, {'best_acc1': best_acc1})
...
Expected behavior A clear and concise description of what you expected to happen.
Screenshots
Environment What is the result of
protobuf 3.19.6 tensorboard 2.10.1 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.1 tensorboardX 2.2 torch 1.11.0 torch-tb-profiler 0.4.0 torchaudio 0.11.0 torchvision 0.12.0
Python environment Which version of python are you using? Did you use Andconda or Virtualenv? Andconda Additional context Add any other context about the problem here.
Hi, I can't reproduce with tensorboardX 2.2.
Do you have more information?
OK, I found the question. i called writer.close() every epochs to refresh the output file. Changing the code like this, i reproduce the bug:
Hi, because the writer was closed and followed by another write operation. We should have a warning for this. Thanks for pointing out!