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
12c1b5b8
"tests/models/vscode:/vscode.git/clone" did not exist on "a6609caf4e544f72026a84aae2989f22d7e4535b"
Unverified
Commit
12c1b5b8
authored
Jan 19, 2021
by
Patrick von Platen
Committed by
GitHub
Jan 19, 2021
Browse files
fix test (#9669)
parent
357fb1c5
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
13 deletions
+13
-13
tests/test_modeling_bart.py
tests/test_modeling_bart.py
+2
-2
tests/test_modeling_blenderbot.py
tests/test_modeling_blenderbot.py
+2
-2
tests/test_modeling_blenderbot_small.py
tests/test_modeling_blenderbot_small.py
+2
-2
tests/test_modeling_common.py
tests/test_modeling_common.py
+1
-1
tests/test_modeling_marian.py
tests/test_modeling_marian.py
+2
-2
tests/test_modeling_mbart.py
tests/test_modeling_mbart.py
+2
-2
tests/test_modeling_pegasus.py
tests/test_modeling_pegasus.py
+2
-2
No files found.
tests/test_modeling_bart.py
View file @
12c1b5b8
...
@@ -61,9 +61,9 @@ def prepare_bart_inputs_dict(
...
@@ -61,9 +61,9 @@ def prepare_bart_inputs_dict(
if
decoder_attention_mask
is
None
:
if
decoder_attention_mask
is
None
:
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
if
head_mask
is
None
:
if
head_mask
is
None
:
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
)
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
,
device
=
torch_device
)
if
decoder_head_mask
is
None
:
if
decoder_head_mask
is
None
:
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
)
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
,
device
=
torch_device
)
return
{
return
{
"input_ids"
:
input_ids
,
"input_ids"
:
input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
...
...
tests/test_modeling_blenderbot.py
View file @
12c1b5b8
...
@@ -48,9 +48,9 @@ def prepare_blenderbot_inputs_dict(
...
@@ -48,9 +48,9 @@ def prepare_blenderbot_inputs_dict(
if
decoder_attention_mask
is
None
:
if
decoder_attention_mask
is
None
:
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
if
head_mask
is
None
:
if
head_mask
is
None
:
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
)
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
,
device
=
torch_device
)
if
decoder_head_mask
is
None
:
if
decoder_head_mask
is
None
:
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
)
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
,
device
=
torch_device
)
return
{
return
{
"input_ids"
:
input_ids
,
"input_ids"
:
input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
...
...
tests/test_modeling_blenderbot_small.py
View file @
12c1b5b8
...
@@ -56,9 +56,9 @@ def prepare_blenderbot_small_inputs_dict(
...
@@ -56,9 +56,9 @@ def prepare_blenderbot_small_inputs_dict(
if
decoder_attention_mask
is
None
:
if
decoder_attention_mask
is
None
:
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
if
head_mask
is
None
:
if
head_mask
is
None
:
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
)
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
,
device
=
torch_device
)
if
decoder_head_mask
is
None
:
if
decoder_head_mask
is
None
:
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
)
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
,
device
=
torch_device
)
return
{
return
{
"input_ids"
:
input_ids
,
"input_ids"
:
input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
...
...
tests/test_modeling_common.py
View file @
12c1b5b8
...
@@ -1073,7 +1073,7 @@ class ModelTesterMixin:
...
@@ -1073,7 +1073,7 @@ class ModelTesterMixin:
# some params shouldn't be scattered by nn.DataParallel
# some params shouldn't be scattered by nn.DataParallel
# so just remove them if they are present.
# so just remove them if they are present.
blacklist_non_batched_params
=
[
"head_mask"
]
blacklist_non_batched_params
=
[
"head_mask"
,
"decoder_head_mask"
]
for
k
in
blacklist_non_batched_params
:
for
k
in
blacklist_non_batched_params
:
inputs_dict
.
pop
(
k
,
None
)
inputs_dict
.
pop
(
k
,
None
)
...
...
tests/test_modeling_marian.py
View file @
12c1b5b8
...
@@ -62,9 +62,9 @@ def prepare_marian_inputs_dict(
...
@@ -62,9 +62,9 @@ def prepare_marian_inputs_dict(
if
decoder_attention_mask
is
None
:
if
decoder_attention_mask
is
None
:
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
if
head_mask
is
None
:
if
head_mask
is
None
:
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
)
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
,
device
=
torch_device
)
if
decoder_head_mask
is
None
:
if
decoder_head_mask
is
None
:
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
)
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
,
device
=
torch_device
)
return
{
return
{
"input_ids"
:
input_ids
,
"input_ids"
:
input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
...
...
tests/test_modeling_mbart.py
View file @
12c1b5b8
...
@@ -57,9 +57,9 @@ def prepare_mbart_inputs_dict(
...
@@ -57,9 +57,9 @@ def prepare_mbart_inputs_dict(
if
decoder_attention_mask
is
None
:
if
decoder_attention_mask
is
None
:
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
if
head_mask
is
None
:
if
head_mask
is
None
:
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
)
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
,
device
=
torch_device
)
if
decoder_head_mask
is
None
:
if
decoder_head_mask
is
None
:
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
)
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
,
device
=
torch_device
)
return
{
return
{
"input_ids"
:
input_ids
,
"input_ids"
:
input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
...
...
tests/test_modeling_pegasus.py
View file @
12c1b5b8
...
@@ -49,9 +49,9 @@ def prepare_pegasus_inputs_dict(
...
@@ -49,9 +49,9 @@ def prepare_pegasus_inputs_dict(
if
decoder_attention_mask
is
None
:
if
decoder_attention_mask
is
None
:
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
decoder_attention_mask
=
decoder_input_ids
.
ne
(
config
.
pad_token_id
)
if
head_mask
is
None
:
if
head_mask
is
None
:
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
)
head_mask
=
torch
.
ones
(
config
.
encoder_layers
,
config
.
encoder_attention_heads
,
device
=
torch_device
)
if
decoder_head_mask
is
None
:
if
decoder_head_mask
is
None
:
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
)
decoder_head_mask
=
torch
.
ones
(
config
.
decoder_layers
,
config
.
decoder_attention_heads
,
device
=
torch_device
)
return
{
return
{
"input_ids"
:
input_ids
,
"input_ids"
:
input_ids
,
"decoder_input_ids"
:
decoder_input_ids
,
"decoder_input_ids"
:
decoder_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