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
850da1cc
Commit
850da1cc
authored
Feb 04, 2019
by
thomwolf
Browse files
strip decoded outputs
parent
01a3966b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
pytorch_pretrained_bert/tokenization_openai.py
pytorch_pretrained_bert/tokenization_openai.py
+1
-1
No files found.
pytorch_pretrained_bert/tokenization_openai.py
View file @
850da1cc
...
@@ -228,5 +228,5 @@ class OpenAIGPTTokenizer(object):
...
@@ -228,5 +228,5 @@ class OpenAIGPTTokenizer(object):
def
decode
(
self
,
ids
,
skip_special_tokens
=
False
):
def
decode
(
self
,
ids
,
skip_special_tokens
=
False
):
"""Converts a sequence of ids in a string."""
"""Converts a sequence of ids in a string."""
tokens
=
self
.
convert_ids_to_tokens
(
ids
,
skip_special_tokens
=
skip_special_tokens
)
tokens
=
self
.
convert_ids_to_tokens
(
ids
,
skip_special_tokens
=
skip_special_tokens
)
out_string
=
''
.
join
(
tokens
).
replace
(
'</w>'
,
' '
)
out_string
=
''
.
join
(
tokens
).
replace
(
'</w>'
,
' '
)
.
strip
()
return
out_string
return
out_string
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