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
ColossalAI
Commits
13ed4b64
Unverified
Commit
13ed4b64
authored
Mar 31, 2022
by
LuGY
Committed by
GitHub
Mar 31, 2022
Browse files
[model zoo] add activation offload for gpt model (#582)
parent
46c9ba33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
model_zoo/gpt/gpt.py
model_zoo/gpt/gpt.py
+6
-3
No files found.
model_zoo/gpt/gpt.py
View file @
13ed4b64
...
...
@@ -165,8 +165,9 @@ class GPTBlock(CheckpointModule):
bias
:
bool
=
True
,
apply_post_layernorm
:
bool
=
False
,
fuse_scale_mask_softmax
:
bool
=
False
,
checkpoint
:
bool
=
False
):
super
().
__init__
(
checkpoint
)
checkpoint
:
bool
=
False
,
activation_offload
:
bool
=
False
):
super
().
__init__
(
checkpoint
,
activation_offload
)
self
.
apply_post_layernorm
=
apply_post_layernorm
self
.
norm1
=
col_nn
.
LayerNorm
(
normalized_shape
=
dim
,
eps
=
layernorm_epsilon
,
dtype
=
dtype
)
self
.
attn
=
GPTSelfAttention
(
dim
=
dim
,
...
...
@@ -252,7 +253,8 @@ class GPT(nn.Module):
bias
:
bool
=
True
,
apply_post_layernorm
:
bool
=
False
,
fuse_scale_mask_softmax
:
bool
=
False
,
checkpoint
:
bool
=
False
)
->
None
:
checkpoint
:
bool
=
False
,
activation_offload
:
bool
=
False
)
->
None
:
super
().
__init__
()
self
.
embed
=
GPTEmbedding
(
embedding_dim
=
dim
,
vocab_size
=
vocab_size
,
...
...
@@ -274,6 +276,7 @@ class GPT(nn.Module):
apply_post_layernorm
=
apply_post_layernorm
,
fuse_scale_mask_softmax
=
fuse_scale_mask_softmax
,
checkpoint
=
checkpoint
,
activation_offload
=
activation_offload
)
for
_
in
range
(
depth
)
])
...
...
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