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
OpenDAS
text-generation-inference
Commits
b94f3021
Unverified
Commit
b94f3021
authored
Jan 03, 2023
by
Nicolas Patry
Committed by
GitHub
Jan 03, 2023
Browse files
fix(server): Use cleanup_tokenization_spaces=False for lossless decoding (#13)
Fixes #12 in the easiest way I could think of.
parent
60472f9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
server/text_generation/models/causal_lm.py
server/text_generation/models/causal_lm.py
+2
-1
No files found.
server/text_generation/models/causal_lm.py
View file @
b94f3021
...
@@ -354,7 +354,8 @@ class CausalLM(Model):
...
@@ -354,7 +354,8 @@ class CausalLM(Model):
if
stop
:
if
stop
:
# Decode all tokens
# Decode all tokens
output_text
=
self
.
tokenizer
.
decode
(
output_text
=
self
.
tokenizer
.
decode
(
all_input_ids
.
squeeze
(
-
1
),
skip_special_tokens
=
True
all_input_ids
.
squeeze
(
-
1
),
skip_special_tokens
=
True
,
cleanup_tokenization_spaces
=
False
)
)
# Slice with input_length to remove padding
# Slice with input_length to remove padding
token_ids
=
all_input_ids
[
-
new_input_length
:]
token_ids
=
all_input_ids
[
-
new_input_length
:]
...
...
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