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
b7b2d6a9
Commit
b7b2d6a9
authored
Aug 05, 2022
by
Peng Xu
Browse files
fix a bug for size mismatch
parent
2e65bee5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
megatron/text_generation/generation.py
megatron/text_generation/generation.py
+1
-1
No files found.
megatron/text_generation/generation.py
View file @
b7b2d6a9
...
@@ -388,7 +388,7 @@ def beam_search_and_return_on_first_stage(model, tokens, lengths, beam_size, sto
...
@@ -388,7 +388,7 @@ def beam_search_and_return_on_first_stage(model, tokens, lengths, beam_size, sto
# if cannot find stop token, add open beams to hyps
# if cannot find stop token, add open beams to hyps
if
not
done
:
if
not
done
:
for
beam_id
in
range
(
beam_size
):
for
beam_id
in
range
(
beam_size
):
beam_hyp
.
add
(
tokens
[
beam_id
].
clone
(),
scores
[
beam_id
],
context_length
+
1
-
prompt_length
)
beam_hyp
.
add
(
tokens
[
beam_id
].
clone
(),
scores
[
beam_id
]
.
squeeze
()
,
context_length
+
1
-
prompt_length
)
# rank based on scores
# rank based on scores
sorted_hyps
=
sorted
(
beam_hyp
.
beams
,
key
=
lambda
x
:
x
[
0
],
reverse
=
True
)
sorted_hyps
=
sorted
(
beam_hyp
.
beams
,
key
=
lambda
x
:
x
[
0
],
reverse
=
True
)
...
...
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