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
2dd8f524
Commit
2dd8f524
authored
Mar 06, 2019
by
thomwolf
Browse files
removing test for long sequences error following #337
parent
5c85fc39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
18 deletions
+0
-18
tests/tokenization_test.py
tests/tokenization_test.py
+0
-18
No files found.
tests/tokenization_test.py
View file @
2dd8f524
...
@@ -46,24 +46,6 @@ class TokenizationTest(unittest.TestCase):
...
@@ -46,24 +46,6 @@ class TokenizationTest(unittest.TestCase):
self
.
assertListEqual
(
self
.
assertListEqual
(
tokenizer
.
convert_tokens_to_ids
(
tokens
),
[
7
,
4
,
5
,
10
,
8
,
9
])
tokenizer
.
convert_tokens_to_ids
(
tokens
),
[
7
,
4
,
5
,
10
,
8
,
9
])
def
test_full_tokenizer_raises_error_for_long_sequences
(
self
):
vocab_tokens
=
[
"[UNK]"
,
"[CLS]"
,
"[SEP]"
,
"want"
,
"##want"
,
"##ed"
,
"wa"
,
"un"
,
"runn"
,
"##ing"
,
","
]
with
open
(
"/tmp/bert_tokenizer_test.txt"
,
"w"
,
encoding
=
'utf-8'
)
as
vocab_writer
:
vocab_writer
.
write
(
""
.
join
([
x
+
"
\n
"
for
x
in
vocab_tokens
]))
vocab_file
=
vocab_writer
.
name
tokenizer
=
BertTokenizer
(
vocab_file
,
max_len
=
10
)
os
.
remove
(
vocab_file
)
tokens
=
tokenizer
.
tokenize
(
u
"the cat sat on the mat in the summer time"
)
indices
=
tokenizer
.
convert_tokens_to_ids
(
tokens
)
self
.
assertListEqual
(
indices
,
[
0
for
_
in
range
(
10
)])
tokens
=
tokenizer
.
tokenize
(
u
"the cat sat on the mat in the summer time ."
)
self
.
assertRaises
(
ValueError
,
tokenizer
.
convert_tokens_to_ids
,
tokens
)
def
test_chinese
(
self
):
def
test_chinese
(
self
):
tokenizer
=
BasicTokenizer
()
tokenizer
=
BasicTokenizer
()
...
...
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