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
f20aec1d
Unverified
Commit
f20aec1d
authored
Oct 26, 2020
by
Sam Shleifer
Committed by
GitHub
Oct 26, 2020
Browse files
fsmt slow test uses lists (#8031)
parent
101186bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tests/test_tokenization_fsmt.py
tests/test_tokenization_fsmt.py
+3
-3
No files found.
tests/test_tokenization_fsmt.py
View file @
f20aec1d
...
...
@@ -144,11 +144,11 @@ class FSMTTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
# for src_text, _ in targets: print(f"""[\n"{src_text}",\n {model.encode(src_text).tolist()}\n],""")
for
src_text
,
tgt_input_ids
in
targets
:
input
_ids
=
tokenizer_enc
.
encode
(
src_text
,
return_tensors
=
"pt"
)[
0
].
tolist
(
)
self
.
assertListEqual
(
input
_ids
,
tgt_input_ids
)
encoded
_ids
=
tokenizer_enc
.
encode
(
src_text
,
return_tensors
=
None
)
self
.
assertListEqual
(
encoded
_ids
,
tgt_input_ids
)
# and decode backward, using the reversed languages model
decoded_text
=
tokenizer_dec
.
decode
(
input
_ids
,
skip_special_tokens
=
True
)
decoded_text
=
tokenizer_dec
.
decode
(
encoded
_ids
,
skip_special_tokens
=
True
)
self
.
assertEqual
(
decoded_text
,
src_text
)
@
unittest
.
skip
(
"FSMTConfig.__init__ requires non-optional args"
)
...
...
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