Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
0ffc8eaf
Commit
0ffc8eaf
authored
Dec 27, 2019
by
Aymeric Augustin
Committed by
Julien Chaumond
Jan 05, 2020
Browse files
Enforce target version for black.
This should stabilize formatting.
parent
f01b3e66
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
21 additions
and
21 deletions
+21
-21
.circleci/config.yml
.circleci/config.yml
+1
-1
Makefile
Makefile
+2
-2
src/transformers/modeling_encoder_decoder.py
src/transformers/modeling_encoder_decoder.py
+1
-1
src/transformers/modeling_tf_utils.py
src/transformers/modeling_tf_utils.py
+1
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+1
-1
src/transformers/pipelines.py
src/transformers/pipelines.py
+1
-1
src/transformers/tokenization_albert.py
src/transformers/tokenization_albert.py
+1
-1
src/transformers/tokenization_bert.py
src/transformers/tokenization_bert.py
+2
-2
src/transformers/tokenization_bert_japanese.py
src/transformers/tokenization_bert_japanese.py
+1
-1
src/transformers/tokenization_camembert.py
src/transformers/tokenization_camembert.py
+1
-1
src/transformers/tokenization_roberta.py
src/transformers/tokenization_roberta.py
+1
-1
src/transformers/tokenization_t5.py
src/transformers/tokenization_t5.py
+1
-1
src/transformers/tokenization_utils.py
src/transformers/tokenization_utils.py
+1
-1
src/transformers/tokenization_xlm.py
src/transformers/tokenization_xlm.py
+1
-1
src/transformers/tokenization_xlm_roberta.py
src/transformers/tokenization_xlm_roberta.py
+1
-1
src/transformers/tokenization_xlnet.py
src/transformers/tokenization_xlnet.py
+1
-1
templates/adding_a_new_model/tokenization_xxx.py
templates/adding_a_new_model/tokenization_xxx.py
+1
-1
tests/test_tokenization_bert.py
tests/test_tokenization_bert.py
+1
-1
tests/test_tokenization_gpt2.py
tests/test_tokenization_gpt2.py
+1
-1
No files found.
.circleci/config.yml
View file @
0ffc8eaf
...
...
@@ -101,7 +101,7 @@ jobs:
# we need a version of isort with https://github.com/timothycrosley/isort/pull/1000
-
run
:
sudo pip install git+git://github.com/timothycrosley/isort.git@e63ae06ec7d70b06df9e528357650281a3d3ec22#egg=isort
-
run
:
sudo pip install .[tf,torch,quality]
-
run
:
black --check --line-length 119 examples templates tests src utils
-
run
:
black --check --line-length 119
--target-version py35
examples templates tests src utils
-
run
:
isort --check-only --recursive examples templates tests src utils
-
run
:
flake8 examples templates tests src utils
check_repository_consistency
:
...
...
Makefile
View file @
0ffc8eaf
...
...
@@ -3,14 +3,14 @@
# Check that source code meets quality standards
quality
:
black
--check
--line-length
119 examples templates tests src utils
black
--check
--line-length
119
--target-version
py35
examples templates tests src utils
isort
--check-only
--recursive
examples templates tests src utils
flake8 examples templates tests src utils
# Format source code automatically
style
:
black
--line-length
119 examples templates tests src utils
black
--line-length
119
--target-version
py35
examples templates tests src utils
isort
--recursive
examples templates tests src utils
# Run tests for the library
...
...
src/transformers/modeling_encoder_decoder.py
View file @
0ffc8eaf
...
...
@@ -325,7 +325,7 @@ class Model2Model(PreTrainedEncoderDecoder):
encoder_pretrained_model_name_or_path
=
pretrained_model_name_or_path
,
decoder_pretrained_model_name_or_path
=
pretrained_model_name_or_path
,
*
args
,
**
kwargs
**
kwargs
,
)
return
model
...
...
src/transformers/modeling_tf_utils.py
View file @
0ffc8eaf
...
...
@@ -250,7 +250,7 @@ class TFPreTrainedModel(tf.keras.Model):
return_unused_kwargs
=
True
,
force_download
=
force_download
,
resume_download
=
resume_download
,
**
kwargs
**
kwargs
,
)
else
:
model_kwargs
=
kwargs
...
...
src/transformers/modeling_utils.py
View file @
0ffc8eaf
...
...
@@ -355,7 +355,7 @@ class PreTrainedModel(nn.Module):
force_download
=
force_download
,
resume_download
=
resume_download
,
proxies
=
proxies
,
**
kwargs
**
kwargs
,
)
else
:
model_kwargs
=
kwargs
...
...
src/transformers/pipelines.py
View file @
0ffc8eaf
...
...
@@ -643,7 +643,7 @@ class QuestionAnsweringPipeline(Pipeline):
framework
=
framework
,
args_parser
=
QuestionAnsweringArgumentHandler
(),
device
=
device
,
**
kwargs
**
kwargs
,
)
@
staticmethod
...
...
src/transformers/tokenization_albert.py
View file @
0ffc8eaf
...
...
@@ -87,7 +87,7 @@ class AlbertTokenizer(PreTrainedTokenizer):
pad_token
=
pad_token
,
cls_token
=
cls_token
,
mask_token
=
mask_token
,
**
kwargs
**
kwargs
,
)
self
.
max_len_single_sentence
=
self
.
max_len
-
2
# take into account special tokens
...
...
src/transformers/tokenization_bert.py
View file @
0ffc8eaf
...
...
@@ -169,7 +169,7 @@ class BertTokenizer(PreTrainedTokenizer):
pad_token
=
pad_token
,
cls_token
=
cls_token
,
mask_token
=
mask_token
,
**
kwargs
**
kwargs
,
)
self
.
max_len_single_sentence
=
self
.
max_len
-
2
# take into account special tokens
self
.
max_len_sentences_pair
=
self
.
max_len
-
3
# take into account special tokens
...
...
@@ -560,7 +560,7 @@ class BertTokenizerFast(PreTrainedTokenizerFast):
pad_token
=
pad_token
,
cls_token
=
cls_token
,
mask_token
=
mask_token
,
**
kwargs
**
kwargs
,
)
self
.
_tokenizer
=
tk
.
Tokenizer
(
tk
.
models
.
WordPiece
.
from_files
(
vocab_file
,
unk_token
=
unk_token
))
...
...
src/transformers/tokenization_bert_japanese.py
View file @
0ffc8eaf
...
...
@@ -113,7 +113,7 @@ class BertJapaneseTokenizer(BertTokenizer):
pad_token
=
pad_token
,
cls_token
=
cls_token
,
mask_token
=
mask_token
,
**
kwargs
**
kwargs
,
)
self
.
max_len_single_sentence
=
self
.
max_len
-
2
# take into account special tokens
self
.
max_len_sentences_pair
=
self
.
max_len
-
3
# take into account special tokens
...
...
src/transformers/tokenization_camembert.py
View file @
0ffc8eaf
...
...
@@ -76,7 +76,7 @@ class CamembertTokenizer(PreTrainedTokenizer):
pad_token
=
pad_token
,
mask_token
=
mask_token
,
additional_special_tokens
=
additional_special_tokens
,
**
kwargs
**
kwargs
,
)
self
.
max_len_single_sentence
=
self
.
max_len
-
2
# take into account special tokens
self
.
max_len_sentences_pair
=
self
.
max_len
-
4
# take into account special tokens
...
...
src/transformers/tokenization_roberta.py
View file @
0ffc8eaf
...
...
@@ -95,7 +95,7 @@ class RobertaTokenizer(GPT2Tokenizer):
cls_token
=
cls_token
,
pad_token
=
pad_token
,
mask_token
=
mask_token
,
**
kwargs
**
kwargs
,
)
self
.
max_len_single_sentence
=
self
.
max_len
-
2
# take into account special tokens
self
.
max_len_sentences_pair
=
self
.
max_len
-
4
# take into account special tokens
...
...
src/transformers/tokenization_t5.py
View file @
0ffc8eaf
...
...
@@ -96,7 +96,7 @@ class T5Tokenizer(PreTrainedTokenizer):
unk_token
=
unk_token
,
pad_token
=
pad_token
,
additional_special_tokens
=
additional_special_tokens
,
**
kwargs
**
kwargs
,
)
try
:
...
...
src/transformers/tokenization_utils.py
View file @
0ffc8eaf
...
...
@@ -817,7 +817,7 @@ class PreTrainedTokenizer(object):
truncation_strategy
=
truncation_strategy
,
pad_to_max_length
=
pad_to_max_length
,
return_tensors
=
return_tensors
,
**
kwargs
**
kwargs
,
)
return
encoded_inputs
[
"input_ids"
]
...
...
src/transformers/tokenization_xlm.py
View file @
0ffc8eaf
...
...
@@ -586,7 +586,7 @@ class XLMTokenizer(PreTrainedTokenizer):
cls_token
=
cls_token
,
mask_token
=
mask_token
,
additional_special_tokens
=
additional_special_tokens
,
**
kwargs
**
kwargs
,
)
self
.
max_len_single_sentence
=
self
.
max_len
-
2
# take into account special tokens
...
...
src/transformers/tokenization_xlm_roberta.py
View file @
0ffc8eaf
...
...
@@ -83,7 +83,7 @@ class XLMRobertaTokenizer(PreTrainedTokenizer):
cls_token
=
cls_token
,
pad_token
=
pad_token
,
mask_token
=
mask_token
,
**
kwargs
**
kwargs
,
)
self
.
max_len_single_sentence
=
self
.
max_len
-
2
# take into account special tokens
self
.
max_len_sentences_pair
=
self
.
max_len
-
4
# take into account special tokens
...
...
src/transformers/tokenization_xlnet.py
View file @
0ffc8eaf
...
...
@@ -86,7 +86,7 @@ class XLNetTokenizer(PreTrainedTokenizer):
cls_token
=
cls_token
,
mask_token
=
mask_token
,
additional_special_tokens
=
additional_special_tokens
,
**
kwargs
**
kwargs
,
)
self
.
max_len_single_sentence
=
self
.
max_len
-
2
# take into account special tokens
...
...
templates/adding_a_new_model/tokenization_xxx.py
View file @
0ffc8eaf
...
...
@@ -115,7 +115,7 @@ class XxxTokenizer(PreTrainedTokenizer):
pad_token
=
pad_token
,
cls_token
=
cls_token
,
mask_token
=
mask_token
,
**
kwargs
**
kwargs
,
)
self
.
max_len_single_sentence
=
self
.
max_len
-
2
# take into account special tokens
self
.
max_len_sentences_pair
=
self
.
max_len
-
3
# take into account special tokens
...
...
tests/test_tokenization_bert.py
View file @
0ffc8eaf
...
...
@@ -84,7 +84,7 @@ class BertTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
tokenizer
=
self
.
get_tokenizer
()
rust_tokenizer
=
self
.
get_rust_tokenizer
(
add_special_tokens
=
False
)
sequence
=
u
"UNwant
\u00E9
d,running"
sequence
=
"UNwant
\u00E9
d,running"
tokens
=
tokenizer
.
tokenize
(
sequence
)
rust_tokens
=
rust_tokenizer
.
tokenize
(
sequence
)
...
...
tests/test_tokenization_gpt2.py
View file @
0ffc8eaf
...
...
@@ -96,7 +96,7 @@ class GPT2TokenizationTest(TokenizerTesterMixin, unittest.TestCase):
tokenizer
=
self
.
get_tokenizer
()
rust_tokenizer
=
self
.
get_rust_tokenizer
(
add_special_tokens
=
False
,
add_prefix_space
=
True
)
sequence
=
u
"lower newer"
sequence
=
"lower newer"
# Testing tokenization
tokens
=
tokenizer
.
tokenize
(
sequence
,
add_prefix_space
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment