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
Megatron-LM
Commits
5c2ce593
"megatron/git@developer.sourcefind.cn:OpenDAS/megatron-lm.git" did not exist on "caa9dca52981edc30b8c4930b7f2ace95a531f36"
Commit
5c2ce593
authored
Apr 21, 2021
by
Mostofa Patwary
Browse files
addressed comments
parent
44bfcb32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
megatron/text_generation_utils.py
megatron/text_generation_utils.py
+5
-4
No files found.
megatron/text_generation_utils.py
View file @
5c2ce593
...
...
@@ -207,13 +207,14 @@ def generate_samples_eval(model, context, max_gen_length, eos_token_id):
with
torch
.
no_grad
():
token_stream
=
get_token_stream
(
model
,
[
context_tokens
])
for
counter
,
decode_tokens
in
enumerate
(
token_stream
):
decode_tokens
,
_
=
decode_tokens
decode_tokens
=
decode_tokens
[
0
].
cpu
().
numpy
().
tolist
()
trim_decode_tokens
=
tokenizer
.
detokenize
(
decode_tokens
)[
raw_text_len
:]
if
counter
==
args
.
out_seq_length
:
break
decode_tokens
,
_
=
decode_tokens
decode_tokens
=
decode_tokens
[
0
].
cpu
().
numpy
().
tolist
()
trim_decode_tokens
=
tokenizer
.
detokenize
(
decode_tokens
)[
raw_text_len
:]
return
trim_decode_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