question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Logs not syncing after switching from tensorboardx to torch.utils.tensorboard

See original GitHub issue

Metrics for my run are not showing up: https://app.wandb.ai/yaroslavvb/test-graphs_test/runs/lbuht9lu?workspace=user-yaroslavvb

Train Epoch: 100 [44928/60000 (75%)]	Loss: 7.943522, Accuracy: 0/44928 (0.00%), Elapsed Time: 225.7s
Train Epoch: 100 [51328/60000 (86%)]	Loss: 7.655457, Accuracy: 0/51328 (0.00%), Elapsed Time: 225.9s
Train Epoch: 100 [57728/60000 (96%)]	Loss: 6.832315, Accuracy: 0/57728 (0.00%), Elapsed Time: 226.1s

wandb: Waiting for W&B process to finish, PID 98062
wandb: Program ended successfully.
wandb: Syncing files in wandb/run-20190821_231347-lbuht9lu:
wandb:   upstream_diff_692e4cc15b4b6acd32f627215194be23445e9d69.patch
wandb: plus 7 W&B file(s) and 0 media file(s)
wandb:                                                                                
wandb: Synced result: https://app.wandb.ai/yaroslavvb/test-graphs_test/runs/lbuht9lu

Process finished with exit code 0

Debug log – debug.log

My current work-around is to use local tensorboard to visualize the run, it looks something like this: Screenshot 2019-08-21 16 22 30

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ira7barcommented, Jan 4, 2021

I have experienced the same problem (using from torch.utils.tensorboard import SummaryWriter) and solved it by first initializing wandb and only then initializing the tensorboard writer. There was no need for manual patching before wandb init.

0reactions
ariG23498commented, Dec 2, 2020

I tried reproducing the problem with the following code snippet:

import wandb
from tensorboardX import SummaryWriter
wandb.tensorboard.patch(root_logdir="exp")
wandb.init(entity="repro", project="tensorboard")
writer = SummaryWriter("exp")
scalars = {
    'scalar_1': 1.0,
    'scalar_2': 2.0,
    'scalar_3': 3.0
}
writer.add_scalars("test", scalars, global_step=1)
writer.close()
wandb.finish()

Somehow wandb is unable to patch the tensorboard to the logdir I suggest here.

On the other hand I tried modifying the code and used torch.utils.tensorboard.SummaryWriter()

import wandb
from torch.utils.tensorboard import SummaryWriter
wandb.tensorboard.patch(root_logdir="exp")
wandb.init(entity="repro", project="tensorboard")
writer = SummaryWriter("exp")
scalars = {
    'scalar_1': 1.0,
    'scalar_2': 2.0,
    'scalar_3': 3.0
}
writer.add_scalars("test", scalars, global_step=1)
writer.close()
wandb.finish()

This worked fine for me. My best guesses would be some complication with the tensorboardX integration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Logs not syncing after switching from tensorboardx to torch ...
My best guess as to what's happening is we're not patching tensorboard properly. If this was the case you should see the following...
Read more >
Can not get pytorch working with tensorboard - Stack Overflow
The error log says, among other things,. ImportError: TensorBoard logging requires TensorBoard with Python summary writer installed.
Read more >
Pytorch sync_tensorboard help - W&B Help - WandB community
I'm having some issues getting W&B to sync with Tensorboard in ... this to work with either torch.utils.tensorboard or tensorboardX and with ...
Read more >
tensorboardX SummaryWriter not working when using gpu
In the tensorboard webpage, I got 'No scalar data was found'. When I terminate the training, the event becomes 100K and I can...
Read more >
A Complete Guide to Using TensorBoard with PyTorch
from torch.utils.tensorboard import SummaryWriter ... Moving the orange dot along the graph will give us a log of the respective ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found