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
b189226e
Unverified
Commit
b189226e
authored
Jul 12, 2021
by
Lysandre Debut
Committed by
GitHub
Jul 12, 2021
Browse files
Fix transfo xl integration test (#12652)
* Cleanup test * Skip TF TransfoXL test
parent
fd41e2da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
678 deletions
+14
-678
tests/test_modeling_tf_transfo_xl.py
tests/test_modeling_tf_transfo_xl.py
+7
-327
tests/test_modeling_transfo_xl.py
tests/test_modeling_transfo_xl.py
+7
-351
No files found.
tests/test_modeling_tf_transfo_xl.py
View file @
b189226e
...
...
@@ -218,157 +218,13 @@ class TFTransfoXLModelTest(TFModelTesterMixin, unittest.TestCase):
@
require_tf
class
TFTransfoXLModelLanguageGenerationTest
(
unittest
.
TestCase
):
@
unittest
.
skip
(
"Skip test until #12651 is resolved."
)
@
slow
def
test_lm_generate_transfo_xl_wt103
(
self
):
model
=
TFTransfoXLLMHeadModel
.
from_pretrained
(
"transfo-xl-wt103"
)
input_ids
=
tf
.
convert_to_tensor
(
[
[
33
,
1297
,
2
,
1
,
1009
,
4
,
1109
,
11739
,
4762
,
358
,
5
,
25
,
245
,
22
,
1706
,
17
,
20098
,
5
,
3215
,
21
,
37
,
1110
,
3
,
13
,
1041
,
4
,
24
,
603
,
490
,
2
,
71477
,
20098
,
104447
,
2
,
20961
,
1
,
2604
,
4
,
1
,
329
,
3
,
6224
,
831
,
16002
,
2
,
8
,
603
,
78967
,
29546
,
23
,
803
,
20
,
25
,
416
,
5
,
8
,
232
,
4
,
277
,
6
,
1855
,
4601
,
3
,
29546
,
54
,
8
,
3609
,
5
,
57211
,
49
,
4
,
1
,
277
,
18
,
8
,
1755
,
15691
,
3
,
341
,
25
,
416
,
693
,
42573
,
71
,
17
,
401
,
94
,
31
,
17919
,
2
,
29546
,
7873
,
18
,
1
,
435
,
23
,
11011
,
755
,
5
,
5167
,
3
,
7983
,
98
,
84
,
2
,
29546
,
3267
,
8
,
3609
,
4
,
1
,
4865
,
1075
,
2
,
6087
,
71
,
6
,
346
,
8
,
5854
,
3
,
29546
,
824
,
1400
,
1868
,
2
,
19
,
160
,
2
,
311
,
8
,
5496
,
2
,
20920
,
17
,
25
,
15097
,
3
,
24
,
24
,
0
,
]
],
dtype
=
tf
.
int32
,
)
# fmt: off
input_ids
=
tf
.
convert_to_tensor
([[
33
,
1297
,
2
,
1
,
1009
,
4
,
1109
,
11739
,
4762
,
358
,
5
,
25
,
245
,
22
,
1706
,
17
,
20098
,
5
,
3215
,
21
,
37
,
1110
,
3
,
13
,
1041
,
4
,
24
,
603
,
490
,
2
,
71477
,
20098
,
104447
,
2
,
20961
,
1
,
2604
,
4
,
1
,
329
,
3
,
6224
,
831
,
16002
,
2
,
8
,
603
,
78967
,
29546
,
23
,
803
,
20
,
25
,
416
,
5
,
8
,
232
,
4
,
277
,
6
,
1855
,
4601
,
3
,
29546
,
54
,
8
,
3609
,
5
,
57211
,
49
,
4
,
1
,
277
,
18
,
8
,
1755
,
15691
,
3
,
341
,
25
,
416
,
693
,
42573
,
71
,
17
,
401
,
94
,
31
,
17919
,
2
,
29546
,
7873
,
18
,
1
,
435
,
23
,
11011
,
755
,
5
,
5167
,
3
,
7983
,
98
,
84
,
2
,
29546
,
3267
,
8
,
3609
,
4
,
1
,
4865
,
1075
,
2
,
6087
,
71
,
6
,
346
,
8
,
5854
,
3
,
29546
,
824
,
1400
,
1868
,
2
,
19
,
160
,
2
,
311
,
8
,
5496
,
2
,
20920
,
17
,
25
,
15097
,
3
,
24
,
24
,
0
]],
dtype
=
tf
.
int32
)
# noqa: E231
# fmt: on
# In 1991 , the remains of Russian Tsar Nicholas II and his family
# ( except for Alexei and Maria ) are discovered .
# The voice of Nicholas's young son , Tsarevich Alexei Nikolaevich , narrates the
...
...
@@ -380,185 +236,9 @@ class TFTransfoXLModelLanguageGenerationTest(unittest.TestCase):
# the Virgin Mary , prompting him to become a priest . Rasputin quickly becomes famous ,
# with people , even a bishop , begging for his blessing . <eod> </s> <eos>
expected_output_ids
=
[
33
,
1297
,
2
,
1
,
1009
,
4
,
1109
,
11739
,
4762
,
358
,
5
,
25
,
245
,
22
,
1706
,
17
,
20098
,
5
,
3215
,
21
,
37
,
1110
,
3
,
13
,
1041
,
4
,
24
,
603
,
490
,
2
,
71477
,
20098
,
104447
,
2
,
20961
,
1
,
2604
,
4
,
1
,
329
,
3
,
6224
,
831
,
16002
,
2
,
8
,
603
,
78967
,
29546
,
23
,
803
,
20
,
25
,
416
,
5
,
8
,
232
,
4
,
277
,
6
,
1855
,
4601
,
3
,
29546
,
54
,
8
,
3609
,
5
,
57211
,
49
,
4
,
1
,
277
,
18
,
8
,
1755
,
15691
,
3
,
341
,
25
,
416
,
693
,
42573
,
71
,
17
,
401
,
94
,
31
,
17919
,
2
,
29546
,
7873
,
18
,
1
,
435
,
23
,
11011
,
755
,
5
,
5167
,
3
,
7983
,
98
,
84
,
2
,
29546
,
3267
,
8
,
3609
,
4
,
1
,
4865
,
1075
,
2
,
6087
,
71
,
6
,
346
,
8
,
5854
,
3
,
29546
,
824
,
1400
,
1868
,
2
,
19
,
160
,
2
,
311
,
8
,
5496
,
2
,
20920
,
17
,
25
,
15097
,
3
,
24
,
24
,
0
,
33
,
1
,
1857
,
2
,
1
,
1009
,
4
,
1109
,
11739
,
4762
,
358
,
5
,
25
,
245
,
28
,
1110
,
3
,
13
,
1041
,
4
,
24
,
603
,
490
,
2
,
71477
,
20098
,
104447
,
2
,
20961
,
1
,
2604
,
4
,
1
,
329
,
3
,
0
,
]
# fmt: off
expected_output_ids
=
[
33
,
1297
,
2
,
1
,
1009
,
4
,
1109
,
11739
,
4762
,
358
,
5
,
25
,
245
,
22
,
1706
,
17
,
20098
,
5
,
3215
,
21
,
37
,
1110
,
3
,
13
,
1041
,
4
,
24
,
603
,
490
,
2
,
71477
,
20098
,
104447
,
2
,
20961
,
1
,
2604
,
4
,
1
,
329
,
3
,
6224
,
831
,
16002
,
2
,
8
,
603
,
78967
,
29546
,
23
,
803
,
20
,
25
,
416
,
5
,
8
,
232
,
4
,
277
,
6
,
1855
,
4601
,
3
,
29546
,
54
,
8
,
3609
,
5
,
57211
,
49
,
4
,
1
,
277
,
18
,
8
,
1755
,
15691
,
3
,
341
,
25
,
416
,
693
,
42573
,
71
,
17
,
401
,
94
,
31
,
17919
,
2
,
29546
,
7873
,
18
,
1
,
435
,
23
,
11011
,
755
,
5
,
5167
,
3
,
7983
,
98
,
84
,
2
,
29546
,
3267
,
8
,
3609
,
4
,
1
,
4865
,
1075
,
2
,
6087
,
71
,
6
,
346
,
8
,
5854
,
3
,
29546
,
824
,
1400
,
1868
,
2
,
19
,
160
,
2
,
311
,
8
,
5496
,
2
,
20920
,
17
,
25
,
15097
,
3
,
24
,
24
,
0
,
33
,
1
,
1857
,
2
,
1
,
1009
,
4
,
1109
,
11739
,
4762
,
358
,
5
,
25
,
245
,
28
,
1110
,
3
,
13
,
1041
,
4
,
24
,
603
,
490
,
2
,
71477
,
20098
,
104447
,
2
,
20961
,
1
,
2604
,
4
,
1
,
329
,
3
,
0
]
# noqa: E231
# fmt: on
# In 1991, the remains of Russian Tsar Nicholas II and his family (
# except for Alexei and Maria ) are discovered. The voice of young son,
# Tsarevich Alexei Nikolaevich, narrates the remainder of the story.
...
...
tests/test_modeling_transfo_xl.py
View file @
b189226e
...
...
@@ -381,155 +381,10 @@ class TransfoXLModelLanguageGenerationTest(unittest.TestCase):
def
test_lm_generate_transfo_xl_wt103
(
self
):
model
=
TransfoXLLMHeadModel
.
from_pretrained
(
"transfo-xl-wt103"
)
model
.
to
(
torch_device
)
input_ids
=
torch
.
tensor
(
[
[
33
,
1297
,
2
,
1
,
1009
,
4
,
1109
,
11739
,
4762
,
358
,
5
,
25
,
245
,
22
,
1706
,
17
,
20098
,
5
,
3215
,
21
,
37
,
1110
,
3
,
13
,
1041
,
4
,
24
,
603
,
490
,
2
,
71477
,
20098
,
104447
,
2
,
20961
,
1
,
2604
,
4
,
1
,
329
,
3
,
6224
,
831
,
16002
,
2
,
8
,
603
,
78967
,
29546
,
23
,
803
,
20
,
25
,
416
,
5
,
8
,
232
,
4
,
277
,
6
,
1855
,
4601
,
3
,
29546
,
54
,
8
,
3609
,
5
,
57211
,
49
,
4
,
1
,
277
,
18
,
8
,
1755
,
15691
,
3
,
341
,
25
,
416
,
693
,
42573
,
71
,
17
,
401
,
94
,
31
,
17919
,
2
,
29546
,
7873
,
18
,
1
,
435
,
23
,
11011
,
755
,
5
,
5167
,
3
,
7983
,
98
,
84
,
2
,
29546
,
3267
,
8
,
3609
,
4
,
1
,
4865
,
1075
,
2
,
6087
,
71
,
6
,
346
,
8
,
5854
,
3
,
29546
,
824
,
1400
,
1868
,
2
,
19
,
160
,
2
,
311
,
8
,
5496
,
2
,
20920
,
17
,
25
,
15097
,
3
,
24
,
24
,
0
,
]
],
dtype
=
torch
.
long
,
device
=
torch_device
,
)
# fmt: off
input_ids
=
torch
.
tensor
([[
33
,
1297
,
2
,
1
,
1009
,
4
,
1109
,
11739
,
4762
,
358
,
5
,
25
,
245
,
22
,
1706
,
17
,
20098
,
5
,
3215
,
21
,
37
,
1110
,
3
,
13
,
1041
,
4
,
24
,
603
,
490
,
2
,
71477
,
20098
,
104447
,
2
,
20961
,
1
,
2604
,
4
,
1
,
329
,
3
,
6224
,
831
,
16002
,
2
,
8
,
603
,
78967
,
29546
,
23
,
803
,
20
,
25
,
416
,
5
,
8
,
232
,
4
,
277
,
6
,
1855
,
4601
,
3
,
29546
,
54
,
8
,
3609
,
5
,
57211
,
49
,
4
,
1
,
277
,
18
,
8
,
1755
,
15691
,
3
,
341
,
25
,
416
,
693
,
42573
,
71
,
17
,
401
,
94
,
31
,
17919
,
2
,
29546
,
7873
,
18
,
1
,
435
,
23
,
11011
,
755
,
5
,
5167
,
3
,
7983
,
98
,
84
,
2
,
29546
,
3267
,
8
,
3609
,
4
,
1
,
4865
,
1075
,
2
,
6087
,
71
,
6
,
346
,
8
,
5854
,
3
,
29546
,
824
,
1400
,
1868
,
2
,
19
,
160
,
2
,
311
,
8
,
5496
,
2
,
20920
,
17
,
25
,
15097
,
3
,
24
,
24
,
0
]],
dtype
=
torch
.
long
,
device
=
torch_device
)
# noqa: E231
# fmt: on
# In 1991 , the remains of Russian Tsar Nicholas II and his family
# ( except for Alexei and Maria ) are discovered .
# The voice of Nicholas's young son , Tsarevich Alexei Nikolaevich , narrates the
...
...
@@ -541,208 +396,9 @@ class TransfoXLModelLanguageGenerationTest(unittest.TestCase):
# the Virgin Mary , prompting him to become a priest . Rasputin quickly becomes famous ,
# with people , even a bishop , begging for his blessing . <eod> </s> <eos>
expected_output_ids
=
[
33
,
1297
,
2
,
1
,
1009
,
4
,
1109
,
11739
,
4762
,
358
,
5
,
25
,
245
,
22
,
1706
,
17
,
20098
,
5
,
3215
,
21
,
37
,
1110
,
3
,
13
,
1041
,
4
,
24
,
603
,
490
,
2
,
71477
,
20098
,
104447
,
2
,
20961
,
1
,
2604
,
4
,
1
,
329
,
3
,
6224
,
831
,
16002
,
2
,
8
,
603
,
78967
,
29546
,
23
,
803
,
20
,
25
,
416
,
5
,
8
,
232
,
4
,
277
,
6
,
1855
,
4601
,
3
,
29546
,
54
,
8
,
3609
,
5
,
57211
,
49
,
4
,
1
,
277
,
18
,
8
,
1755
,
15691
,
3
,
341
,
25
,
416
,
693
,
42573
,
71
,
17
,
401
,
94
,
31
,
17919
,
2
,
29546
,
7873
,
18
,
1
,
435
,
23
,
11011
,
755
,
5
,
5167
,
3
,
7983
,
98
,
84
,
2
,
29546
,
3267
,
8
,
3609
,
4
,
1
,
4865
,
1075
,
2
,
6087
,
71
,
6
,
346
,
8
,
5854
,
3
,
29546
,
824
,
1400
,
1868
,
2
,
19
,
160
,
2
,
311
,
8
,
5496
,
2
,
20920
,
17
,
25
,
15097
,
3
,
24
,
24
,
0
,
33
,
1
,
142
,
1298
,
188
,
2
,
29546
,
113
,
8
,
3654
,
4
,
1
,
1109
,
7136
,
833
,
3
,
13
,
1645
,
4
,
29546
,
11
,
104
,
7
,
1
,
1109
,
532
,
7129
,
2
,
10
,
83507
,
2
,
1162
,
1123
,
2
,
6
,
7245
,
10
,
2
,
5
,
11
,
104
,
7
,
1
,
1109
,
532
,
7129
,
2
,
10
,
24
,
24
,
10
,
22
,
10
,
13
,
770
,
5863
,
4
,
7245
,
10
,
]
# fmt: off
expected_output_ids
=
[
33
,
1297
,
2
,
1
,
1009
,
4
,
1109
,
11739
,
4762
,
358
,
5
,
25
,
245
,
22
,
1706
,
17
,
20098
,
5
,
3215
,
21
,
37
,
1110
,
3
,
13
,
1041
,
4
,
24
,
603
,
490
,
2
,
71477
,
20098
,
104447
,
2
,
20961
,
1
,
2604
,
4
,
1
,
329
,
3
,
6224
,
831
,
16002
,
2
,
8
,
603
,
78967
,
29546
,
23
,
803
,
20
,
25
,
416
,
5
,
8
,
232
,
4
,
277
,
6
,
1855
,
4601
,
3
,
29546
,
54
,
8
,
3609
,
5
,
57211
,
49
,
4
,
1
,
277
,
18
,
8
,
1755
,
15691
,
3
,
341
,
25
,
416
,
693
,
42573
,
71
,
17
,
401
,
94
,
31
,
17919
,
2
,
29546
,
7873
,
18
,
1
,
435
,
23
,
11011
,
755
,
5
,
5167
,
3
,
7983
,
98
,
84
,
2
,
29546
,
3267
,
8
,
3609
,
4
,
1
,
4865
,
1075
,
2
,
6087
,
71
,
6
,
346
,
8
,
5854
,
3
,
29546
,
824
,
1400
,
1868
,
2
,
19
,
160
,
2
,
311
,
8
,
5496
,
2
,
20920
,
17
,
25
,
15097
,
3
,
24
,
24
,
0
,
33
,
1
,
142
,
1298
,
188
,
2
,
29546
,
113
,
8
,
3654
,
4
,
1
,
1109
,
7136
,
833
,
3
,
13
,
1645
,
4
,
29546
,
11
,
104
,
7
,
1
,
1109
,
532
,
7129
,
2
,
10
,
83507
,
2
,
1162
,
1123
,
2
,
6
,
7245
,
10
,
2
,
5
,
11
,
104
,
7
,
1
,
1109
,
532
,
7129
,
2
,
10
,
24
,
24
,
10
,
22
,
10
,
13
,
770
,
5863
,
4
,
7245
,
10
]
# noqa: E231
# fmt: on
# In 1991, the remains of Russian Tsar Nicholas II and his family ( except for
# Alexei and Maria ) are discovered. The voice of young son, Tsarevich Alexei
# Nikolaevich, narrates the remainder of the story. 1883 Western Siberia, a young
...
...
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