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
apex
Commits
f54cc1c9
Commit
f54cc1c9
authored
May 21, 2020
by
Kexin Yu
Browse files
make fused LAMB async
parent
8abb6908
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
apex/optimizers/fused_lamb.py
apex/optimizers/fused_lamb.py
+1
-1
csrc/multi_tensor_lamb.cu
csrc/multi_tensor_lamb.cu
+2
-2
csrc/multi_tensor_lamb_stage_1.cu
csrc/multi_tensor_lamb_stage_1.cu
+1
-1
No files found.
apex/optimizers/fused_lamb.py
View file @
f54cc1c9
...
@@ -132,7 +132,7 @@ class FusedLAMB(torch.optim.Optimizer):
...
@@ -132,7 +132,7 @@ class FusedLAMB(torch.optim.Optimizer):
global_grad_norm
=
multi_tensor_applier
(
self
.
multi_tensor_l2norm
,
global_grad_norm
=
multi_tensor_applier
(
self
.
multi_tensor_l2norm
,
self
.
_dummy_overflow_buf
,
self
.
_dummy_overflow_buf
,
[[
g_norm_32
,
g_norm_16
]],
[[
g_norm_32
,
g_norm_16
]],
False
)[
0
]
.
item
()
False
)[
0
]
max_grad_norm
=
self
.
defaults
[
'max_grad_norm'
]
max_grad_norm
=
self
.
defaults
[
'max_grad_norm'
]
for
group
in
self
.
param_groups
:
for
group
in
self
.
param_groups
:
...
...
csrc/multi_tensor_lamb.cu
View file @
f54cc1c9
...
@@ -52,7 +52,7 @@ struct LAMBStage1Functor
...
@@ -52,7 +52,7 @@ struct LAMBStage1Functor
const
float
epsilon
,
const
float
epsilon
,
adamMode_t
mode
,
adamMode_t
mode
,
const
float
decay
,
const
float
decay
,
const
float
global_grad_norm
,
at
::
Tensor
global_grad_norm
,
const
float
max_global_grad_norm
)
const
float
max_global_grad_norm
)
{
{
// I'd like this kernel to propagate infs/nans.
// I'd like this kernel to propagate infs/nans.
...
@@ -342,7 +342,7 @@ void multi_tensor_lamb_cuda(
...
@@ -342,7 +342,7 @@ void multi_tensor_lamb_cuda(
const
float
weight_decay
,
const
float
weight_decay
,
const
int
grad_averaging
,
const
int
grad_averaging
,
const
int
mode
,
const
int
mode
,
const
float
global_grad_norm
,
at
::
Tensor
global_grad_norm
,
const
float
max_grad_norm
,
const
float
max_grad_norm
,
at
::
optional
<
bool
>
use_nvlamb_python
)
at
::
optional
<
bool
>
use_nvlamb_python
)
{
{
...
...
csrc/multi_tensor_lamb_stage_1.cu
View file @
f54cc1c9
...
@@ -118,7 +118,7 @@ void multi_tensor_lamb_stage1_cuda(
...
@@ -118,7 +118,7 @@ void multi_tensor_lamb_stage1_cuda(
const
float
beta1
,
const
float
beta1
,
const
float
beta2
,
const
float
beta2
,
const
float
epsilon
,
const
float
epsilon
,
const
float
global_grad_norm
,
at
::
Tensor
global_grad_norm
,
const
float
max_global_grad_norm
)
const
float
max_global_grad_norm
)
{
{
using
namespace
at
;
using
namespace
at
;
...
...
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