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
6a733827
Commit
6a733827
authored
Dec 10, 2019
by
LysandreJik
Browse files
Complete warning + cleanup
parent
dc4e9e5c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
examples/run_squad.py
examples/run_squad.py
+0
-1
transformers/tokenization_utils.py
transformers/tokenization_utils.py
+2
-2
No files found.
examples/run_squad.py
View file @
6a733827
...
@@ -299,7 +299,6 @@ def evaluate(args, model, tokenizer, prefix=""):
...
@@ -299,7 +299,6 @@ def evaluate(args, model, tokenizer, prefix=""):
# XLNet and XLM use a more complex post-processing procedure
# XLNet and XLM use a more complex post-processing procedure
if
args
.
model_type
in
[
'xlnet'
,
'xlm'
]:
if
args
.
model_type
in
[
'xlnet'
,
'xlm'
]:
start_n_top
=
model
.
config
.
start_n_top
if
hasattr
(
model
,
"config"
)
else
model
.
module
.
config
.
start_n_top
start_n_top
=
model
.
config
.
start_n_top
if
hasattr
(
model
,
"config"
)
else
model
.
module
.
config
.
start_n_top
end_n_top
=
model
.
config
.
end_n_top
if
hasattr
(
model
,
"config"
)
else
model
.
module
.
config
.
end_n_top
end_n_top
=
model
.
config
.
end_n_top
if
hasattr
(
model
,
"config"
)
else
model
.
module
.
config
.
end_n_top
...
...
transformers/tokenization_utils.py
View file @
6a733827
...
@@ -226,7 +226,7 @@ class PreTrainedTokenizer(object):
...
@@ -226,7 +226,7 @@ class PreTrainedTokenizer(object):
self
.
max_len
=
max_len
if
max_len
is
not
None
else
int
(
1e12
)
self
.
max_len
=
max_len
if
max_len
is
not
None
else
int
(
1e12
)
# Padding side is right by default and over-riden in subclsses. If specified in the kwargs, it is changed.
# Padding side is right by default and over-riden in subcl
a
sses. If specified in the kwargs, it is changed.
self
.
padding_side
=
kwargs
.
pop
(
'padding_side'
,
self
.
padding_side
)
self
.
padding_side
=
kwargs
.
pop
(
'padding_side'
,
self
.
padding_side
)
# Added tokens
# Added tokens
...
@@ -1003,7 +1003,7 @@ class PreTrainedTokenizer(object):
...
@@ -1003,7 +1003,7 @@ class PreTrainedTokenizer(object):
)
)
if
pad_to_max_length
and
max_length
is
None
and
self
.
max_len
>
10000
:
if
pad_to_max_length
and
max_length
is
None
and
self
.
max_len
>
10000
:
logger
.
warning
(
"Sequence can't be padded as
the maximum
"
)
logger
.
warning
(
"Sequence can't be padded as
no maximum length is specified and the model maximum length is too high.
"
)
if
needs_to_be_padded
:
if
needs_to_be_padded
:
difference
=
(
max_length
if
max_length
is
not
None
else
self
.
max_len
)
-
len
(
encoded_inputs
[
"input_ids"
])
difference
=
(
max_length
if
max_length
is
not
None
else
self
.
max_len
)
-
len
(
encoded_inputs
[
"input_ids"
])
...
...
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