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
e6c0019c
Commit
e6c0019c
authored
Dec 23, 2019
by
Aymeric Augustin
Browse files
Remove unused variables in tests.
parent
495580da
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
6 deletions
+2
-6
tests/test_modeling_common.py
tests/test_modeling_common.py
+1
-2
tests/test_modeling_tf_common.py
tests/test_modeling_tf_common.py
+1
-1
tests/test_modeling_tf_xlm.py
tests/test_modeling_tf_xlm.py
+0
-1
tests/test_tokenization_common.py
tests/test_tokenization_common.py
+0
-2
No files found.
tests/test_modeling_common.py
View file @
e6c0019c
...
...
@@ -284,7 +284,6 @@ class ModelTesterMixin:
multihead_outputs
=
head_mask
.
grad
attentions
=
outputs
[
-
1
]
hidden_states
=
outputs
[
-
2
]
# Remove Nan
for
t
in
attentions
:
...
...
@@ -590,7 +589,7 @@ class ModelTesterMixin:
inputs_dict
[
"decoder_inputs_embeds"
]
=
wte
(
decoder_input_ids
)
with
torch
.
no_grad
():
outputs
=
model
(
**
inputs_dict
)
model
(
**
inputs_dict
)
class
ConfigTester
(
object
):
...
...
tests/test_modeling_tf_common.py
View file @
e6c0019c
...
...
@@ -332,7 +332,7 @@ class TFModelTesterMixin:
inputs_dict
[
"encoder_inputs_embeds"
]
=
self
.
_get_embeds
(
wte
,
encoder_input_ids
)
inputs_dict
[
"decoder_inputs_embeds"
]
=
self
.
_get_embeds
(
wte
,
decoder_input_ids
)
outputs
=
model
(
inputs_dict
)
model
(
inputs_dict
)
def
ids_tensor
(
shape
,
vocab_size
,
rng
=
None
,
name
=
None
,
dtype
=
None
):
...
...
tests/test_modeling_tf_xlm.py
View file @
e6c0019c
...
...
@@ -224,7 +224,6 @@ class TFXLMModelTest(TFModelTesterMixin, unittest.TestCase):
inputs
=
{
"input_ids"
:
input_ids
,
"lengths"
:
input_lengths
}
outputs
=
model
(
inputs
)
start_logits
,
end_logits
=
model
(
inputs
)
result
=
{
...
...
tests/test_tokenization_common.py
View file @
e6c0019c
...
...
@@ -159,7 +159,6 @@ class TokenizerTesterMixin:
self
.
assertEqual
(
all_size_2
,
all_size
+
len
(
new_toks
))
tokens
=
tokenizer
.
encode
(
"aaaaa bbbbbb low cccccccccdddddddd l"
,
add_special_tokens
=
False
)
out_string
=
tokenizer
.
decode
(
tokens
)
self
.
assertGreaterEqual
(
len
(
tokens
),
4
)
self
.
assertGreater
(
tokens
[
0
],
tokenizer
.
vocab_size
-
1
)
...
...
@@ -178,7 +177,6 @@ class TokenizerTesterMixin:
tokens
=
tokenizer
.
encode
(
">>>>|||<||<<|<< aaaaabbbbbb low cccccccccdddddddd <<<<<|||>|>>>>|> l"
,
add_special_tokens
=
False
)
out_string
=
tokenizer
.
decode
(
tokens
)
self
.
assertGreaterEqual
(
len
(
tokens
),
6
)
self
.
assertGreater
(
tokens
[
0
],
tokenizer
.
vocab_size
-
1
)
...
...
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