transformers icon indicating copy to clipboard operation
transformers copied to clipboard

Add missing optional argument summary_proj_to_labels to XLNetConfig

Open akashsara opened this issue 1 year ago • 2 comments

What does this PR do?

XLNetConfig (src\transformers\models\xlnet\configuration_xlnet.py) lists an argument summary_proj_to_labels as optional and with a default value of True. However, this is not actually included in the arguments and is not set anywhere. Initializing an XLNet model thus results in no such parameter existing. Also fixes a very minor typo (boo -> bool).

For reference: the same argument also is utilized in XLMConfig (src\transformers\models\xlm\configuration_xlm.py) but is actually utilized there.

From personal experience, this argument is used in SequenceSummary (src\transformers\modeling_utils.py). When using default arguments, there is an inconsistency between the models where one would have hidden_size -> hidden_size layers while the other would have hidden_size -> num_labels layers.

Before submitting

  • [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • [x] 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?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag members/contributors who may be interested in your PR.

cc: @sgugger

Still a draft right now. Need to make changes to the tests to adapt to this. Please let me know if this is intended functionality though.

akashsara avatar Mar 08 '23 08:03 akashsara

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

Yes. I wanted to get some clarity on that before working on fixing the tests. From a logical perspective, I would believe that the argument should exist since at the end of the day it decides only one thing - "Whether the projection outputs should have config.num_labels or config.hidden_size classes.". As it stands, it will only use config.hidden_size classes since the argument doesn't currently exist. Do you know someone who might be able to clarify this?

I believe the tests are failing since this change causes the output of the summary layer to be different. Setting summary_proj_to_labels=False causes all tests to pass locally. I'll look into the tests sometime this weekend assuming that we want to include this change.

akashsara avatar Mar 09 '23 01:03 akashsara

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Apr 07 '23 15:04 github-actions[bot]