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

Assertions to exceptions #13692

Merged
merged 10 commits into from
Sep 22, 2021
Merged

Assertions to exceptions #13692

merged 10 commits into from
Sep 22, 2021

Conversation

MocktaiLEngineer
Copy link
Contributor

@MocktaiLEngineer MocktaiLEngineer commented Sep 22, 2021

What does this PR do?

This PR addresses the issue #12789
I have modified the file transformers/src/transformers/tokenization_utils.py file to throw a type error instead of assertions.

Fixes # (issue)

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.

Copy link
Contributor

@patil-suraj patil-suraj left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this!

Could you run make style and make quality from the root of the repo? That should fix the failing test.

src/transformers/tokenization_utils.py Outdated Show resolved Hide resolved
Raise exceptions instead of using assertions for control flow

Co-authored-by: Suraj Patil <surajp815@gmail.com>
Copy link
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 for fixing!

src/transformers/tokenization_utils.py Outdated Show resolved Hide resolved
MocktaiLEngineer and others added 2 commits September 22, 2021 17:49
Raise exceptions instead of using assertions for control flow

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

sgugger commented Sep 22, 2021

Note that you still need to run make style on your branch to fix the code quality check.

@MocktaiLEngineer
Copy link
Contributor Author

Thank you for fixing this!

Could you run make style and make quality from the root of the repo? That should fix the failing test.

Thank you so much, will do!

@MocktaiLEngineer
Copy link
Contributor Author

Note that you still need to run make style on your branch to fix the code quality check.

Yes, this is my first time contributing to a PR, so I'm sorry if I'm being a little slow. I have run the 'make style', hoping it passes this time. And thanks for approving the changes :)

@sgugger
Copy link
Collaborator

sgugger commented Sep 22, 2021

No problem, we all have to learn and start somewhere :-)
The last test failure is unrelated to this PR (flaky test) so merging. Thanks again for your contribution!

@sgugger sgugger merged commit a0c08aa into huggingface:master Sep 22, 2021
Narsil pushed a commit to Narsil/transformers that referenced this pull request Sep 25, 2021
* Raise exceptions instead of using assertions for control flow huggingface#12789

* # coding=utf-8

* Raise exceptions instead of using assertions for control flow

* Raise exceptions instead of using assertions for control flow

* Update src/transformers/tokenization_utils.py

Raise exceptions instead of using assertions for control flow

Co-authored-by: Suraj Patil <surajp815@gmail.com>

* Update src/transformers/tokenization_utils.py

Raise exceptions instead of using assertions for control flow

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

* Raise exceptions instead of using assertions for control flow

* test

* Raise exceptions instead of using assertions for control flow

Co-authored-by: MocktaiLEngineer <kavinarasu22@gmail.com>
Co-authored-by: Suraj Patil <surajp815@gmail.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
stas00 pushed a commit to stas00/transformers that referenced this pull request Oct 12, 2021
* Raise exceptions instead of using assertions for control flow huggingface#12789

* # coding=utf-8

* Raise exceptions instead of using assertions for control flow

* Raise exceptions instead of using assertions for control flow

* Update src/transformers/tokenization_utils.py

Raise exceptions instead of using assertions for control flow

Co-authored-by: Suraj Patil <surajp815@gmail.com>

* Update src/transformers/tokenization_utils.py

Raise exceptions instead of using assertions for control flow

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

* Raise exceptions instead of using assertions for control flow

* test

* Raise exceptions instead of using assertions for control flow

Co-authored-by: MocktaiLEngineer <kavinarasu22@gmail.com>
Co-authored-by: Suraj Patil <surajp815@gmail.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Albertobegue pushed a commit to Albertobegue/transformers that referenced this pull request Jan 13, 2022
* Raise exceptions instead of using assertions for control flow huggingface#12789

* # coding=utf-8

* Raise exceptions instead of using assertions for control flow

* Raise exceptions instead of using assertions for control flow

* Update src/transformers/tokenization_utils.py

Raise exceptions instead of using assertions for control flow

Co-authored-by: Suraj Patil <surajp815@gmail.com>

* Update src/transformers/tokenization_utils.py

Raise exceptions instead of using assertions for control flow

Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>

* Raise exceptions instead of using assertions for control flow

* test

* Raise exceptions instead of using assertions for control flow

Co-authored-by: MocktaiLEngineer <kavinarasu22@gmail.com>
Co-authored-by: Suraj Patil <surajp815@gmail.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
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.

None yet

4 participants