facebookresearch / fairseq

Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
MIT License
30.43k stars 6.4k forks source link

Text Classification with XLM Roberta #2302

Closed Srj closed 2 years ago

Srj commented 4 years ago

After extracting last layer features using this line of code

last_layer_features = xlmr.extract_features(zh_tokens)

Will the following line extract feature for text classification?

out = last_layer_features[:,0] #out is the feature for text classification that will be passed to a classifier.

lematt1991 commented 4 years ago

Yep, that's what the classification heads do

charlesfufu commented 3 years ago

Yep, that's what the classification heads do

why ''last_layer_features = xlmr.extract_features(zh_tokens)'' just jump to the function of ''fairseq.models.roberta.hub_interface.RobertaHubInterface.extract_features'' ? what the difference between ''fairseq.models.roberta.model.RobertaEncoder.extract_features'' and ''fairseq.models.roberta.hub_interface.RobertaHubInterface.extract_features'' ?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] commented 2 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!