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
76aab90a
Unverified
Commit
76aab90a
authored
Nov 17, 2024
by
Kunshang Ji
Committed by
GitHub
Nov 17, 2024
Browse files
[Hardware] [HPU]add `mark_step` for hpu (#10239)
Signed-off-by:
Kunshang Ji
<
kunshang.ji@intel.com
>
parent
8d74b5ae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
vllm/worker/hpu_model_runner.py
vllm/worker/hpu_model_runner.py
+14
-0
No files found.
vllm/worker/hpu_model_runner.py
View file @
76aab90a
...
...
@@ -272,6 +272,19 @@ def precompute_indices_and_offsets(block_size, slot_mapping, is_prompt):
return
indices
,
offsets
def
modify_decoder_layer
(
module
:
torch
.
nn
.
Module
,
suffix
=
"DecoderLayer"
):
if
module
.
__class__
.
__name__
.
endswith
(
suffix
):
def
forward_hook
(
module
,
args
,
output
):
htorch
.
core
.
mark_step
()
return
output
module
.
register_forward_hook
(
forward_hook
)
for
child_name
,
child_module
in
module
.
named_children
():
modify_decoder_layer
(
child_module
)
class
HpuModelAdapter
:
def
__init__
(
self
,
model
,
block_size
,
dtype
,
enforce_eager
):
...
...
@@ -636,6 +649,7 @@ class HPUModelRunnerBase(ModelRunnerBase[TModelInputForHPU]):
else
:
self
.
model
=
self
.
model
.
to
(
"hpu"
)
htcore
.
mark_step
()
modify_decoder_layer
(
self
.
model
)
torch
.
hpu
.
synchronize
()
with
HabanaMemoryProfiler
()
as
m_wrap
:
...
...
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