# BertForSequenceClassification finetune training loss and accuracy have some problem

**URL:** <https://discuss.huggingface.co/t/bertforsequenceclassification-finetune-training-loss-and-accuracy-have-some-problem/2814>\
**Category:** 🤗Transformers\
**Created:** [December 14, 2020, 6:16am UTC](https://discuss.huggingface.co/t/bertforsequenceclassification-finetune-training-loss-and-accuracy-have-some-problem/2814 "2020-12-14T06:16:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![good74152](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@good74152](https://discuss.huggingface.co/u/good74152)\
**Post date:** [December 14, 2020, 6:16am UTC](https://discuss.huggingface.co/t/bertforsequenceclassification-finetune-training-loss-and-accuracy-have-some-problem/2814/1 "2020-12-14T06:16:43Z")

</div>

Model I am using Bert for BertTokenizer, BertForSequenceClassification

The problem arises when using:  
Use Trainer to fine-tuning on training set, but the Training log is No log or 0.696694, and accuracy is always 0.X00000

The tasks I am working on is:  
An official GLUE task: sst2, using by huggingface datasets package

The details:  
Trainer setting I follow the examples/text\_classification.ipynb to build the compute\_metrics function and tokenize mapping function, but the training loss and accuracy have bug

my trainer and arguments:

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/a/a0860a3fcae29675cc67308d5552f119672a0419.png)

encoded\_training\_no\_mask and encoded\_val\_set format is dataset follows like:  
Dataset({  
features: [‘attention\_mask’, ‘idx’, ‘input\_ids’, ‘label’, ‘labels’, ‘sentence’, ‘token\_type\_ids’],  
num\_rows: XXX  
})

The column ‘lables’ content is same with ‘label’ contents
