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
ecfddc60
"...git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "a81b88a01af040fabf2c8145fbfeb82aecdb256c"
Commit
ecfddc60
authored
Sep 26, 2019
by
LysandreJik
Browse files
Update RoBERTa and GPT-2 Tokenizer documentation (fix #1343)
parent
93f0c5fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
transformers/tokenization_gpt2.py
transformers/tokenization_gpt2.py
+4
-3
transformers/tokenization_roberta.py
transformers/tokenization_roberta.py
+4
-3
No files found.
transformers/tokenization_gpt2.py
View file @
ecfddc60
...
@@ -101,9 +101,10 @@ class GPT2Tokenizer(PreTrainedTokenizer):
...
@@ -101,9 +101,10 @@ class GPT2Tokenizer(PreTrainedTokenizer):
"""
"""
GPT-2 BPE tokenizer. Peculiarities:
GPT-2 BPE tokenizer. Peculiarities:
- Byte-level Byte-Pair-Encoding
- Byte-level Byte-Pair-Encoding
- Requires a space to start the input string => will add a space is there isn't.
- Requires a space to start the input string => the encoding methods should be called with the
As a consequence, this tokenizer `encode` and `decode` method will not conserve
``add_prefix_space`` flag set to ``True``.
the absence of a space at the beginning of a string: `tokenizer.decode(tokenizer.encode("Hello")) = " Hello"
Otherwise, this tokenizer ``encode`` and ``decode`` method will not conserve
the absence of a space at the beginning of a string: `tokenizer.decode(tokenizer.encode("Hello")) = " Hello"`
"""
"""
vocab_files_names
=
VOCAB_FILES_NAMES
vocab_files_names
=
VOCAB_FILES_NAMES
pretrained_vocab_files_map
=
PRETRAINED_VOCAB_FILES_MAP
pretrained_vocab_files_map
=
PRETRAINED_VOCAB_FILES_MAP
...
...
transformers/tokenization_roberta.py
View file @
ecfddc60
...
@@ -66,9 +66,10 @@ class RobertaTokenizer(GPT2Tokenizer):
...
@@ -66,9 +66,10 @@ class RobertaTokenizer(GPT2Tokenizer):
"""
"""
RoBERTa BPE tokenizer, derived from the GPT-2 tokenizer. Peculiarities:
RoBERTa BPE tokenizer, derived from the GPT-2 tokenizer. Peculiarities:
- Byte-level Byte-Pair-Encoding
- Byte-level Byte-Pair-Encoding
- Requires a space to start the input string => will add a space is there isn't.
- Requires a space to start the input string => the encoding methods should be called with the
As a consequence, this tokenizer `encode` and `decode` method will not conserve
``add_prefix_space`` flag set to ``True``.
the absence of a space at the beginning of a string: `tokenizer.decode(tokenizer.encode("Hello")) = " Hello"
Otherwise, this tokenizer ``encode`` and ``decode`` method will not conserve
the absence of a space at the beginning of a string: `tokenizer.decode(tokenizer.encode("Hello")) = " Hello"`
"""
"""
vocab_files_names
=
VOCAB_FILES_NAMES
vocab_files_names
=
VOCAB_FILES_NAMES
pretrained_vocab_files_map
=
PRETRAINED_VOCAB_FILES_MAP
pretrained_vocab_files_map
=
PRETRAINED_VOCAB_FILES_MAP
...
...
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