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
cfc6924b
Commit
cfc6924b
authored
Feb 04, 2020
by
Mostofa Patwary
Browse files
fixed a bug on fp16 while generating samples
parent
4ad5717e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
generate_samples.py
generate_samples.py
+4
-0
No files found.
generate_samples.py
View file @
cfc6924b
...
@@ -98,6 +98,10 @@ def get_batch(context_tokens, args):
...
@@ -98,6 +98,10 @@ def get_batch(context_tokens, args):
args
.
reset_attention_mask
,
args
.
reset_attention_mask
,
False
)
False
)
# Fp16 conversion.
if
args
.
fp16
:
attention_mask
=
attention_mask
.
half
()
return
tokens
,
attention_mask
,
position_ids
return
tokens
,
attention_mask
,
position_ids
def
top_k_logits
(
logits
,
top_k
=
0
,
top_p
=
0.0
,
filter_value
=-
float
(
'Inf'
)):
def
top_k_logits
(
logits
,
top_k
=
0
,
top_p
=
0.0
,
filter_value
=-
float
(
'Inf'
)):
...
...
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