Tensorboardx: add_text not working unless closing writer

Created on 24 Jan 2019  ·  8Comments  ·  Source: lanpa/tensorboardX

Hi
I've noticed (also after reading other issues) that add_text does not display it until you closes the writer.
tensorboardX 1.6
tensorboard 1.8
Is there any reason why?

Most helpful comment

For me it is also not showing even though with writer.close()
this code produces the image below:
writer.add_text('lr', 'learning rate', lr) writer.add_text('wd', 'weight decay', wd)

screen shot 2019-02-15 at 17 11 03

tensorboardX 1.6
pytorch 0.4
tensorboard 1.12

All 8 comments

I have the same problem. Also, writing several times (with incremental time steps) only produces the first step on screen (after closing the SummaryWriter and refreshing tensorboard).

For me it is also not showing even though with writer.close()
this code produces the image below:
writer.add_text('lr', 'learning rate', lr) writer.add_text('wd', 'weight decay', wd)

screen shot 2019-02-15 at 17 11 03

tensorboardX 1.6
pytorch 0.4
tensorboard 1.12

Hi all, I need some code to reproduce the issue. @BPiepmatz The third argument accepts integer (the iteration number). For your case, add_text('learning rate', str(lr), 1) makes more sense.

@lanpa Oh I see, same issue still appearing. This is the whole code ` learning_rates = [1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7, 1e-8]
wd = 0.0002
opt_names = ['RMSprop']
nAveGrad = 5 # Average the gradient every nAveGrad iterations
nEpochs = 200 * nAveGrad # Number of epochs for train
snapshot = nEpochs # Store a model every snapshot epochs
gpu_id = 0
device = torch.device("cuda:" + str(gpu_id) if torch.cuda.is_available() else "cpu")

for lr in learning_rates:
    for opt_name in opt_names:
        model_file_name = datetime.now(gettz('Europe/Berlin')).strftime(
            '%b%d_%H-%M-%S') + '_' + socket.gethostname() + '-' + str(
            lr) + '-' + str(nEpochs) + '-' + str(wd) + '-' + str(lr) + '-' + str(opt_name)
        log_dir = os.path.join('tensorboard_log/runs', model_file_name)

        # Logging into Tensorboard
        writer = SummaryWriter(log_dir=log_dir)

        # Load Network
        print('Loading model...')
        net = CustomNet(pretrained=False)
        optimizer = choose_optimizer(opt_name, net)
        writer.add_text('lr', str(lr), 1)
        writer.add_text('wd', str(wd), 2)
        # writer.add_text('nAveGrad', nAveGrad, 2)
        # writer.add_text('Optimizer', opt_name, 3)

        x = torch.randn(1, 3, 480, 854)
        y = torch.randn(1, 3, 480, 854)
        writer.add_graph(net, (x, y))
        net.to(device)
        writer.close()
        print('Model loaded')`

Does this help?

Best

@BPiepmatz It should be writer.add_text('lr', str(lr), n_iter)
I would write:

for n_iter, lr in enumerate(learning_rates):
  writer.add_text('lr', str(lr), n_iter)

I also have the same problem
tensorboardX 1.6
pytorch 1.0
tensorboard 1.12

I have the very same problem - blank field instead of text.

After checking .tfevents file, everything seems to be on its place. It is hard to say definitely, but It is possible, that this is a tensorboard problem.

Part of .tfevents where I can find my texts:

loss/train^U/A  Cpç\^N"^@^@^@^@^@^@^@x^Q=ý      (>ò^H"1×A^PÐ^O*^T
^R
^Kspeed/train^U<89>×^HFMW^B3-^@^@^@^@^@^@^@<A<8a>û      2       û^H"1×A^PÐ^O*^_
^]
^Vgpu_memory_usage/train^U^@<88><9c>EÇd®t0^@^@^@^@^@^@^@<95>õÐ_ L3ô     "1×A^PÐ^O*"
 :^DtestB^N^H^G^R^D^R^B^H^AB^DtestJ^H
^F
^Dtext^P^FÙ2¯^B^@^@^@^@^@^@r¥öÔ ^P9ô    "1×A^PÐ^O* ^E
<9d>^E:^FsourceB<88>^E^H^G^R^D^R^B^H^ABý^DChavez checked his bolter and slapped home afresh magazine .
I am now married to Gweneth , who is English , and we have two children , Carl and Michelle .
In other words , NATO is very much interested in a number of joint operations with Russia .
The purpose in using such contracts and clauses is to provide the firm legal basis required for concluding an agreement acceptable to both sides .
Of course , political struggles are never - ending , but in this case the mass media are hostage to artificially created events that are often orchestrated by spin doctors .
By 2005 it became necessary to address additional user requirements .J^H
^F
^Dtexth²¢hÀ^D^@^@^@^@^@^@jú<9c>ö        )>ô     "1×A^PÐ^O*±
®       :^FtargetB<99>  ^H^G^R^D^R^B^H^AB<8e>   <s> Ð<9a>апиÑ<82>ан пÑ<80>овеÑ<80>ил его болÑ<82>еÑ<80> и вÑ<81>Ñ<82>авил новÑ<8b>й магазин . </s>
<s> СейÑ<87>аÑ<81> Ñ<8f> женаÑ<82> на Ð<93>винеÑ<82> , она англиÑ<87>анка , и Ñ<83> наÑ<81> двое деÑ<82>ей : Ð<9a>аÑ<80>л и Ð<9c>иÑ<88>елÑ<8c> . </s>
<s> Ð<94>Ñ<80>Ñ<83>гими Ñ<81>ловами , Ð<9d>Ð<90>ТÐ<9e> веÑ<81>Ñ<8c>ма заинÑ<82>еÑ<80>еÑ<81>овано в Ñ<80>Ñ<8f>де Ñ<81>овмеÑ<81>Ñ<82>нÑ<8b>Ñ<85> Ñ<81> РоÑ<81>Ñ<81>ией опеÑ<80>аÑ<86>ий , вÑ<8b>полнение коÑ<82>оÑ<80>Ñ<8b>Ñ<85> длÑ<8f> ниÑ<85> жизненно важно . </s>
<s> ЦелÑ<8c> иÑ<81>полÑ<8c>зованиÑ<8f> Ñ<82>акиÑ<85> конÑ<82>Ñ<80>акÑ<82>ов и оговоÑ<80>ок - Ñ<8d>Ñ<82>о обеÑ<81>пеÑ<87>ение пÑ<80>оÑ<87>ной пÑ<80>авовой базой , необÑ<85>одимой длÑ<8f> заклÑ<8e>Ñ<87>ениÑ<8f> пÑ<80>иемлемого длÑ<8f> обеиÑ<85> Ñ<81>Ñ<82>оÑ<80>он Ñ<81>оглаÑ<88>ениÑ<8f> . </s>
<s> Ð<9d>о СÐ<9c>Ð<98> в данном Ñ<81>лÑ<83>Ñ<87>ае Ñ<81>Ñ<82>ановÑ<8f>Ñ<82>Ñ<81>Ñ<8f> заложниками Ñ<81>озданнÑ<8b>Ñ<85> Ñ<81>пеÑ<86>иалÑ<8c>но Ñ<81>обÑ<8b>Ñ<82>ий , за коÑ<82>оÑ<80>Ñ<8b>ми Ñ<87>аÑ<81>Ñ<82>о Ñ<81>Ñ<82>оÑ<8f>Ñ<82> полиÑ<82>Ñ<82>еÑ<85>нологи . </s>
<s> Ð<9a> 2005 годÑ<83> поÑ<8f>вилаÑ<81>Ñ<8c> необÑ<85>одимоÑ<81>Ñ<82>Ñ<8c> в Ñ<80>аÑ<81>Ñ<88>иÑ<80>ении возможноÑ<81>Ñ<82>ей пÑ<80>оÑ<82>окола . </s>J^H
^F
^Dtext0wíOû^A^@^@^@^@^@^@^^<9f><98>û    ^T[ô    "1×A^PÐ^O*ì^C
é^C:
translatedBÐ^C^H^G^R^D^R^B^H^ABÅ^C<unk> <unk> и <unk> <unk> .
Я <unk> , <unk> , <unk> , <unk> , <unk> , <unk> и <unk> .
Ð<9a>Ñ<80>оме Ñ<82>ого , <unk> , <unk> , <unk> <unk> <unk> <unk> .
<unk> <unk> , <unk> и <unk> , <unk> , <unk> и <unk> , в Ñ<82>ом Ñ<87>иÑ<81>ле как <unk> <unk> , <unk> <unk> <unk> <unk> .
<unk> <unk> , но не <unk> , но не <unk> , но не <unk> , но в Ñ<8d>Ñ<82>ом Ñ<81>лÑ<83>Ñ<87>ае <unk> <unk> .
Ð<92> наÑ<81>Ñ<82>оÑ<8f>Ñ<89>ее вÑ<80>емÑ<8f> <unk> <unk> <unk> <unk> <unk> .J^H
^F
^Dtext13ûx!^@^@^@^@^@^@^@^A{ìö  uèj
"1×A^PÚ^O*^S
^Q

loss/train^UÊ<82>^OC´æ+."^@^@^@^@^@^@^@x^Q=ý    cêj
"1×A^PÚ^O*^T
^R
^Kspeed/train^U
^P¨DÞ>"^R!^@^@^@^@^@^@^@^A{ìö   a¼¢
"1×A^Pä^O*^S
^Q

We will have flush() for the summarywriter after #451 is merged. Then you can call writer.flush() manually to replace close().

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ZhengRui picture ZhengRui  ·  7Comments

yaodi833 picture yaodi833  ·  6Comments

acgtyrant picture acgtyrant  ·  4Comments

chinmay5 picture chinmay5  ·  5Comments

mbenami picture mbenami  ·  6Comments