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
TransformerEngine
Commits
ded8b9bd
Unverified
Commit
ded8b9bd
authored
Jul 18, 2023
by
Kirthi Shankar Sivamani
Committed by
GitHub
Jul 18, 2023
Browse files
Fix numerics for activation recompute (#327)
Signed-off-by:
Kirthi Shankar Sivamani
<
ksivamani@nvidia.com
>
parent
2a81e939
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
transformer_engine/pytorch/jit.py
transformer_engine/pytorch/jit.py
+4
-3
No files found.
transformer_engine/pytorch/jit.py
View file @
ded8b9bd
...
@@ -220,7 +220,7 @@ def warmup_jit_bias_gelu(
...
@@ -220,7 +220,7 @@ def warmup_jit_bias_gelu(
bias
=
torch
.
rand
(
ffn_hidden_size_per_partition
,
dtype
=
dtype
,
device
=
"cuda"
)
bias
=
torch
.
rand
(
ffn_hidden_size_per_partition
,
dtype
=
dtype
,
device
=
"cuda"
)
inp
=
torch
.
rand
(
inp
=
torch
.
rand
(
(
seq_length
,
micro_batch_size
,
ffn_hidden_size_per_partition
),
(
seq_length
*
micro_batch_size
,
ffn_hidden_size_per_partition
),
dtype
=
dtype
,
dtype
=
dtype
,
device
=
"cuda"
,
device
=
"cuda"
,
)
)
...
@@ -229,8 +229,9 @@ def warmup_jit_bias_gelu(
...
@@ -229,8 +229,9 @@ def warmup_jit_bias_gelu(
for
bias_grad
,
input_grad
in
zip
([
True
,
True
],
[
False
,
True
]):
for
bias_grad
,
input_grad
in
zip
([
True
,
True
],
[
False
,
True
]):
bias
.
requires_grad
,
inp
.
requires_grad
=
bias_grad
,
input_grad
bias
.
requires_grad
,
inp
.
requires_grad
=
bias_grad
,
input_grad
for
_
in
range
(
5
):
for
_
in
range
(
5
):
output
=
bias_gelu_fused
(
inp
,
bias
)
_
=
bias_gelu_fused_
(
inp
,
bias
)
del
bias
,
inp
,
output
_
=
gelu_fused_
(
inp
)
del
bias
,
inp
torch
.
cuda
.
empty_cache
()
torch
.
cuda
.
empty_cache
()
torch
.
cuda
.
set_rng_state
(
rng_state
)
torch
.
cuda
.
set_rng_state
(
rng_state
)
...
...
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