I am trying to use pytorch with tensorboard and I run the tensorboard server with the following command:
Now I am just simulating some fake data as follows:
import numpy as np import time from torch.utils.tensorboard import SummaryWriter train_writer = SummaryWriter(log_dir="./runs/train/") for i in range(100): v = np.random.randint(10, 100) train_writer.add_scalar("loss", v, i) #time.sleep(1) train_writer.close()
Now if I do not put the sleep method in there, the script finishes and I can see the graph on the tensorboard front end.
I put the
sleep in there so that I could see the data arrive in a streaming fashion and be able to see the board updating. However, if I put the
sleep in there, no graph ever shows up and all I see is the message that there is no data or it could not find any.
I am not sure if this is a tensorboard issue or if I am doing something wrong in using it from within pytorch.