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

Add typing.overload for convert_ids_tokens #6637

Merged

Conversation

tamuhey
Copy link
Contributor

@tamuhey tamuhey commented Aug 21, 2020

The annotation of convert_ids_tokens is not sufficient. When ids are List[str] and str, the return type are always List[int] and int respectively.
It can be solved with typing.overload

@codecov
Copy link

codecov bot commented Aug 21, 2020

Codecov Report

Merging #6637 into master will increase coverage by 0.80%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6637      +/-   ##
==========================================
+ Coverage   79.47%   80.28%   +0.80%     
==========================================
  Files         156      156              
  Lines       28245    28251       +6     
==========================================
+ Hits        22448    22681     +233     
+ Misses       5797     5570     -227     
Impacted Files Coverage Δ
src/transformers/tokenization_utils.py 89.84% <71.42%> (-0.56%) ⬇️
src/transformers/modeling_tf_flaubert.py 24.53% <0.00%> (-63.81%) ⬇️
src/transformers/modeling_xlnet.py 60.81% <0.00%> (-22.62%) ⬇️
src/transformers/modeling_roberta.py 77.37% <0.00%> (-19.71%) ⬇️
src/transformers/modeling_transfo_xl_utilities.py 52.98% <0.00%> (-13.44%) ⬇️
src/transformers/modeling_transfo_xl.py 67.17% <0.00%> (-12.53%) ⬇️
src/transformers/tokenization_xlm_roberta.py 84.52% <0.00%> (-10.72%) ⬇️
src/transformers/tokenization_utils_base.py 90.24% <0.00%> (-3.53%) ⬇️
src/transformers/generation_tf_utils.py 86.71% <0.00%> (+0.25%) ⬆️
src/transformers/file_utils.py 82.41% <0.00%> (+0.25%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bdf7e5d...0d86fc4. Read the comment docs.

@julien-c
Copy link
Member

LGTM but will let others chime in

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.

Cool, like this a lot!

@tamuhey
Copy link
Contributor Author

tamuhey commented Aug 24, 2020

@LysandreJik What else should I do to merge this PR?

@LysandreJik LysandreJik merged commit 841f071 into huggingface:master Aug 25, 2020
@tamuhey tamuhey deleted the fix/convert_ids_tokens_annotation branch August 25, 2020 09:52
Zigur pushed a commit to Zigur/transformers that referenced this pull request Oct 26, 2020
fabiocapsouza pushed a commit to fabiocapsouza/transformers that referenced this pull request Nov 15, 2020
fabiocapsouza added a commit to fabiocapsouza/transformers that referenced this pull request Nov 15, 2020
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

3 participants