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
38bba9cd
Unverified
Commit
38bba9cd
authored
Jun 18, 2020
by
Karthikeyan Singaravelan
Committed by
GitHub
Jun 17, 2020
Browse files
Fix deprecation warnings due to invalid escape sequences. (#4924)
parent
f1a3d037
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/tokenization_transfo_xl.py
src/transformers/tokenization_transfo_xl.py
+2
-2
No files found.
src/transformers/tokenization_transfo_xl.py
View file @
38bba9cd
...
@@ -114,7 +114,7 @@ class TransfoXLTokenizer(PreTrainedTokenizer):
...
@@ -114,7 +114,7 @@ class TransfoXLTokenizer(PreTrainedTokenizer):
self
.
delimiter
=
delimiter
self
.
delimiter
=
delimiter
self
.
vocab_file
=
vocab_file
self
.
vocab_file
=
vocab_file
self
.
never_split
=
never_split
self
.
never_split
=
never_split
self
.
punctuation_symbols
=
'!"#$%&()*+,-./\:;<=>?@[
\\
]^_`{|}~'
# noqa: W605
self
.
punctuation_symbols
=
'!"#$%&()*+,-./
\
\
:;<=>?@[
\\
]^_`{|}~'
self
.
punction_without_space_before_pattern
=
re
.
compile
(
r
"[^\s][{}]"
.
format
(
self
.
punctuation_symbols
))
self
.
punction_without_space_before_pattern
=
re
.
compile
(
r
"[^\s][{}]"
.
format
(
self
.
punctuation_symbols
))
self
.
punctuation_with_space_around_pattern
=
self
.
_compile_space_around_punctuation_pattern
()
self
.
punctuation_with_space_around_pattern
=
self
.
_compile_space_around_punctuation_pattern
()
...
@@ -141,7 +141,7 @@ class TransfoXLTokenizer(PreTrainedTokenizer):
...
@@ -141,7 +141,7 @@ class TransfoXLTokenizer(PreTrainedTokenizer):
def
_compile_space_around_punctuation_pattern
(
self
):
def
_compile_space_around_punctuation_pattern
(
self
):
look_ahead_for_special_token
=
"(?=[{}])"
.
format
(
self
.
punctuation_symbols
)
look_ahead_for_special_token
=
"(?=[{}])"
.
format
(
self
.
punctuation_symbols
)
look_ahead_to_match_all_except_space
=
"(?=[^\s])"
# noqa: W605
look_ahead_to_match_all_except_space
=
r
"(?=[^\s])"
return
re
.
compile
(
r
""
+
look_ahead_for_special_token
+
look_ahead_to_match_all_except_space
)
return
re
.
compile
(
r
""
+
look_ahead_for_special_token
+
look_ahead_to_match_all_except_space
)
def
count_file
(
self
,
path
,
verbose
=
False
,
add_eos
=
False
):
def
count_file
(
self
,
path
,
verbose
=
False
,
add_eos
=
False
):
...
...
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