Log training accuracy using Trainer class


I am running BertForSequenceClassification and I would like to log the accuracy as well as other metrics that I have already defined for my training set . I saw in another issue that I have to add a self.evaluate(self.train_dataset) somewhere in the code, but I am a beginner when it comes to Python and deep learning in general so I am not sure where exactly I have to include it.

I was trying to replicate the evaluate() method of the Trainer class, taking the train_dataset as argument, but it did not work. It would really mean a lot if you could guide me as for where I should tweak the code!

Thank you for your help!

Hi, I am having a similar issue. I used the Trainer similar to the example and all I see in the output is the training loss but I don’t see any training accuracy. I wonder if find out how to log accuracy. Thanks.