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
9a4521dd
Unverified
Commit
9a4521dd
authored
Jan 23, 2024
by
cmathw
Committed by
GitHub
Jan 23, 2024
Browse files
Support single token decode for `CodeGenTokenizer` (#28628)
convert token id to list in .decode()
parent
5b5e71dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/transformers/models/codegen/tokenization_codegen.py
src/transformers/models/codegen/tokenization_codegen.py
+4
-1
No files found.
src/transformers/models/codegen/tokenization_codegen.py
View file @
9a4521dd
...
...
@@ -23,7 +23,7 @@ from typing import TYPE_CHECKING, List, Optional, Tuple, Union
import
numpy
as
np
import
regex
as
re
from
...utils
import
is_tf_available
,
is_torch_available
,
logging
from
...utils
import
is_tf_available
,
is_torch_available
,
logging
,
to_py_obj
if
TYPE_CHECKING
:
...
...
@@ -352,6 +352,9 @@ class CodeGenTokenizer(PreTrainedTokenizer):
Returns:
`str`: The decoded sentence.
"""
token_ids
=
to_py_obj
(
token_ids
)
decoded_text
=
super
().
_decode
(
token_ids
=
token_ids
,
skip_special_tokens
=
skip_special_tokens
,
...
...
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