Skip to content
New issue

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

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

Already on GitHub? # to your account

Modify this code for better accuracy #40

Open
1033020837 opened this issue Feb 26, 2020 · 1 comment
Open

Modify this code for better accuracy #40

1033020837 opened this issue Feb 26, 2020 · 1 comment

Comments

@1033020837
Copy link

According to this document:https://huggingface.co/transformers/model_doc/bert.html:
the pooler_output of bert_model is usually not a good summary of the semantic content of the input, we should better with averaging or pooling the sequence of hidden-states for the whole input sequence.

So modify the BertForMultiLabel.py to:
avg_output = torch.mean(outputs[0],1).view(-1,self.config.hidden_size)
logits = self.classifier(avg_output)

You could get better performance through this modification.

@lonePatient
Copy link
Owner

@1033020837 Thanks a lot, I will try.

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

No branches or pull requests

2 participants