Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
4440e8c0
Commit
4440e8c0
authored
Aug 22, 2024
by
zhuwenwen
Browse files
use opt layernorm_kernels
parent
d8ae62c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
vllm/model_executor/layers/layernorm.py
vllm/model_executor/layers/layernorm.py
+26
-26
No files found.
vllm/model_executor/layers/layernorm.py
View file @
4440e8c0
...
@@ -52,36 +52,36 @@ class RMSNorm(CustomOp):
...
@@ -52,36 +52,36 @@ class RMSNorm(CustomOp):
from
vllm
import
_custom_ops
as
ops
from
vllm
import
_custom_ops
as
ops
if
residual
is
not
None
:
if
residual
is
not
None
:
# if envs.VLLM_USE_OPT_OP:
if
envs
.
VLLM_USE_OPT_OP
:
# ops.fused_add_rms_norm_opt(
ops
.
fused_add_rms_norm_opt
(
# x,
x
,
# residual,
residual
,
# self.weight.data,
self
.
weight
.
data
,
# self.variance_epsilon,
self
.
variance_epsilon
,
# )
)
# else:
else
:
ops
.
fused_add_rms_norm
(
ops
.
fused_add_rms_norm
(
x
,
residual
,
self
.
weight
.
data
,
self
.
variance_epsilon
,
)
return
x
,
residual
out
=
torch
.
empty_like
(
x
)
if
envs
.
VLLM_USE_OPT_OP
:
ops
.
rms_norm_opt
(
out
,
x
,
x
,
residual
,
self
.
weight
.
data
,
self
.
weight
.
data
,
self
.
variance_epsilon
,
self
.
variance_epsilon
,
)
)
return
x
,
residual
else
:
out
=
torch
.
empty_like
(
x
)
ops
.
rms_norm
(
# if envs.VLLM_USE_OPT_OP:
out
,
# ops.rms_norm_opt(
x
,
# out,
self
.
weight
.
data
,
# x,
self
.
variance_epsilon
,
# self.weight.data,
)
# self.variance_epsilon,
# )
# else:
ops
.
rms_norm
(
out
,
x
,
self
.
weight
.
data
,
self
.
variance_epsilon
,
)
return
out
return
out
def
extra_repr
(
self
)
->
str
:
def
extra_repr
(
self
)
->
str
:
...
...
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