Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Added TF TransfoXL Sequence Classification #9169

Merged
merged 12 commits into from
Dec 19, 2020

Conversation

spatil6
Copy link
Contributor

@spatil6 spatil6 commented Dec 17, 2020

This PR implements Sequence classification for TF TransfoXL model.
TFTransfoXLForSequenceClassification uses the last token in order to do the classification, as other causal models (e.g. GPT-1 ,GPT-2) do.

Fixes #7623

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

@LysandreJik @jplu

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. @jplu if you have nothing to say, feel free to merge the PR.

tests/test_modeling_tf_transfo_xl.py Outdated Show resolved Hide resolved
Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meant to approve, finger slipped.

@@ -131,6 +141,12 @@ def create_and_check_transfo_xl_lm_head(self, config, input_ids_1, input_ids_2,
[(self.mem_len, self.batch_size, self.hidden_size)] * self.num_hidden_layers,
)

def create_and_check_transfo_xl_for_sequence_classification(self, config, input_ids_1, input_ids_2, lm_labels):
config.num_labels = self.num_labels
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LysandreJik I have defined 'num_labels' here.
Now,I'll move it to 'prepare_config_and_inputs'

Copy link
Contributor

@jplu jplu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jplu jplu merged commit e0e255b into huggingface:master Dec 19, 2020
@spatil6 spatil6 deleted the tf_transfoxl_seq_classifier branch December 19, 2020 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement PyTorch and/or TensorFlow sequence classification architectures for causal language models
3 participants