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
945e5b94
Commit
945e5b94
authored
Dec 31, 2024
by
wxj
Browse files
Update language_model.py, 添加torch.compile
parent
99a0c39e
Pipeline
#2185
passed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
megatron/legacy/model/language_model.py
megatron/legacy/model/language_model.py
+4
-0
No files found.
megatron/legacy/model/language_model.py
View file @
945e5b94
...
...
@@ -15,6 +15,9 @@ from .module import MegatronModule
from
.transformer
import
ParallelTransformer
from
.utils
import
get_linear_layer
,
init_method_normal
,
scaled_init_method_normal
import
torch._dynamo
torch
.
_dynamo
.
config
.
suppress_errors
=
True
def
parallel_lm_logits
(
input_
,
word_embeddings_weight
,
parallel_output
,
bias
=
None
):
"""LM logits using word embedding weights."""
...
...
@@ -468,6 +471,7 @@ class TransformerLanguageModel(MegatronModule):
else
:
raise
Exception
(
'Stage must have at least either encoder or decoder'
)
@
torch
.
compile
(
mode
=
"max-autotune-no-cudagraphs"
)
def
forward
(
self
,
enc_input_ids
,
...
...
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