codertimo / BERT-pytorch

Google AI 2018 BERT pytorch implementation
Apache License 2.0
6.15k stars 1.3k forks source link

pred_loss decrease fast while avg_acc stay at 50% #32

Open jiqiujia opened 5 years ago

jiqiujia commented 5 years ago

I try to run the code on a small dataset and I find that pred_loss decrease fast while avg_acc stay at 50%. It is strange to me since decrease in pred_loss should indicates increase in accuracy. image

zheolong commented 5 years ago

@shionhonda How do u print the accuracy for every few global steps, and finally create that curve?

shionhonda commented 5 years ago

@zheolong The loss and accuracy is exactly what is printed on console by data_iter in pretrain.py. Insert the following code here and plot it.

with open(FILENAME, 'a') as f:
    f.write('%d,%f,%f\n' %(i, avg_loss/(i+1), total_correct/total_element*100))
scuhz commented 4 years ago

oh my god ! I have no idea about this. I have the same result with avg_acc =50, according these methods in the issue.