Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't show scalar #320

Closed
zhangguangzhi opened this issue Mar 14, 2018 · 7 comments
Closed

Can't show scalar #320

zhangguangzhi opened this issue Mar 14, 2018 · 7 comments

Comments

@zhangguangzhi
Copy link

My program uses main() to call the trained function train(), which I have in my train function. Here is my program file. When I executed, there was no expected result, Can't show scalar.

1
2
image

@zhangguangzhi
Copy link
Author

Chinese:我的程序是使用main()来调用训练的函数train(),我在我的train函数,以下是我的程序文件。当我执行时,没有出现预想的结果,图形可显示step,但是无法显示值。
而且只能查看到最后一个step

@jetfuel
Copy link
Collaborator

jetfuel commented Mar 14, 2018

@zhangguangzhi It seems that the t_loss was not updated. You can try to generate some fake logs manually to check if the visualDL is working

import random
from visualdl import ROOT, LogWriter

logdir = './scratch_log'
logw = LogWriter(logdir, 2000)

# create scalars in mode train and test.
with logw.mode('train') as logger:
    scalar0 = logger.scalar("scratch/scalar")

with logw.mode('test') as logger:
    scalar1 = logger.scalar("scratch/scalar")

# add fake scalar records. 
last_record0 = 0.
last_record1 = 0.
for step in range(1, 1000):
    last_record0 += 0.1 * (random.random() - 0.3)
    last_record1 += 0.1 * (random.random() - 0.7)
    scalar0.add_record(step, last_record0)
    scalar1.add_record(step, last_record1)

@yeyupiaoling
Copy link

@zhangguangzhi
My program happen this problem just now. You can try again. close VisualDL, and then start again.

@zhangguangzhi
Copy link
Author

@jetfuel Virsualdl is normal
image

@zhangguangzhi
Copy link
Author

@jetfuel
I modified my code, trained five times, showed the first t_loss for the first time, and finally showed the fifth t_loss. Not a line.
image
first train
image
second train
image

@zhangguangzhi
Copy link
Author

@jetfuel Thank you
I will take out this configuration and it will do.
logger = LogWriter("./log", sync_cycle=1) with logger.mode("t_loss") as logger: train_loss = logger.scalar("loss/val")

@jetfuel
Copy link
Collaborator

jetfuel commented Mar 14, 2018

@zhangguangzhi Ah, I see that you create the logger within the for-loop. To use VisualDL, you only need to create the scalar log writer once. Then use that scalar log writer in your training process.

Also, it is recommended to set your sync_cycle larger if you want to record more data points. Saving to file system is expansive. The team is aware of this and is working to improve the performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants