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
38dbbc26
Unverified
Commit
38dbbc26
authored
May 31, 2023
by
Sam Passaglia
Committed by
GitHub
May 31, 2023
Browse files
Fix bug leading to missing token in GPTSanJapaneseTokenizer (#23883)
* add \n * removed copied from header
parent
03db5910
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
src/transformers/models/gptsan_japanese/tokenization_gptsan_japanese.py
...rs/models/gptsan_japanese/tokenization_gptsan_japanese.py
+1
-2
No files found.
src/transformers/models/gptsan_japanese/tokenization_gptsan_japanese.py
View file @
38dbbc26
...
@@ -55,7 +55,6 @@ PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
...
@@ -55,7 +55,6 @@ PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
}
}
# Copied from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese.load_vocab_and_emoji
def
load_vocab_and_emoji
(
vocab_file
,
emoji_file
):
def
load_vocab_and_emoji
(
vocab_file
,
emoji_file
):
"""Loads a vocabulary file and emoji file into a dictionary."""
"""Loads a vocabulary file and emoji file into a dictionary."""
with
open
(
emoji_file
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
emoji_file
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
...
@@ -66,7 +65,7 @@ def load_vocab_and_emoji(vocab_file, emoji_file):
...
@@ -66,7 +65,7 @@ def load_vocab_and_emoji(vocab_file, emoji_file):
ids_to_tokens
=
collections
.
OrderedDict
()
ids_to_tokens
=
collections
.
OrderedDict
()
with
open
(
vocab_file
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
vocab_file
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
token
=
f
.
readlines
()
token
=
f
.
readlines
()
token
=
[[
t
.
rstrip
(
"
\n
"
)]
if
(
t
==
","
or
","
not
in
t
)
else
t
.
rstrip
(
"
\n
"
).
split
(
","
)
for
t
in
token
]
token
=
[[
t
.
rstrip
(
"
\n
"
)]
if
(
t
==
",
\n
"
or
","
not
in
t
)
else
t
.
rstrip
(
"
\n
"
).
split
(
","
)
for
t
in
token
]
for
idx
,
b
in
enumerate
(
token
):
for
idx
,
b
in
enumerate
(
token
):
ids_to_tokens
[
idx
]
=
b
ids_to_tokens
[
idx
]
=
b
raw_vocab
[
","
.
join
(
b
)]
=
idx
raw_vocab
[
","
.
join
(
b
)]
=
idx
...
...
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