Skip to content

Replace assert by ValueError of src/transformers/models/electra/modeling_{electra,tf_electra}.py and all other models that had copies#13955

Merged
sgugger merged 16 commits intohuggingface:masterfrom
AkechiShiro:replace-assert-models-modeling-electra-by-exception
Oct 11, 2021
Merged

Replace assert by ValueError of src/transformers/models/electra/modeling_{electra,tf_electra}.py and all other models that had copies#13955
sgugger merged 16 commits intohuggingface:masterfrom
AkechiShiro:replace-assert-models-modeling-electra-by-exception

Conversation

@AkechiShiro
Copy link
Copy Markdown
Contributor

@AkechiShiro AkechiShiro commented Oct 10, 2021

What does this PR do?

Related to issue: #12789

I've had to change others files in order that the code_check_quality tests passes, if there is any change that should be removed please feel free to let me know.

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?

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.

I'm tagging @LysandreJik because I have modified the albert and bert models as well as other that had to be changed in order for the code_quality_check to pass.

@AkechiShiro AkechiShiro force-pushed the replace-assert-models-modeling-electra-by-exception branch from f183373 to 3860118 Compare October 10, 2021 19:49
@AkechiShiro AkechiShiro force-pushed the replace-assert-models-modeling-electra-by-exception branch from 7c726b3 to a6fc239 Compare October 10, 2021 20:50
* Change multiples models assertion to ValueError in order to validate
  check_code_style test and models template test.
@AkechiShiro AkechiShiro changed the title Replace assert by ValueError in src/transformers/models/electra/modeling_{electra,tf_electra}.py Replace assert by ValueError of src/transformers/models/electra/modeling_{electra,tf_electra}.py and all other models that were copies Oct 10, 2021
@AkechiShiro AkechiShiro changed the title Replace assert by ValueError of src/transformers/models/electra/modeling_{electra,tf_electra}.py and all other models that were copies Replace assert by ValueError of src/transformers/models/electra/modeling_{electra,tf_electra}.py and all other models that had copies Oct 10, 2021
Copy link
Copy Markdown
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks a lot for fixing those, added a few comments :-)

AkechiShiro and others added 9 commits October 11, 2021 19:42
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
…rt.py

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
@AkechiShiro
Copy link
Copy Markdown
Contributor Author

Thank you for your suggestion about the ValueError message and the simplification made to the logic to improve readability, I think this PR is ready to merge.

@sgugger
Copy link
Copy Markdown
Collaborator

sgugger commented Oct 11, 2021

Thanks a lot for adapting!

@sgugger sgugger merged commit 3499728 into huggingface:master Oct 11, 2021
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.

2 participants