Skip to content

Commit

Permalink
Apply changes from pr 194(split gptbigcode forward) to qwen2 (#219)
Browse files Browse the repository at this point in the history
Apply changes from #194 (split
gptbigcode forward) to qwen2
  • Loading branch information
ssarkar2 committed Sep 3, 2024
2 parents 574a1b5 + 8f75dce commit f8dd294
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vllm/model_executor/models/qwen2.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
ParallelLMHead, VocabParallelEmbedding)
from vllm.model_executor.model_loader.weight_utils import (
default_weight_loader, maybe_remap_kv_scale_name)
from vllm.platforms import current_platform
from vllm.model_executor.sampling_metadata import SamplingMetadata
from vllm.sequence import IntermediateTensors, SamplerOutput

Expand Down Expand Up @@ -259,6 +260,11 @@ def forward(
hidden_states = inputs_embeds
else:
hidden_states = self.embed_tokens(input_ids)

if current_platform.is_hpu():
import habana_frameworks.torch as htorch
htorch.core.mark_step()

residual = None
for i in range(len(self.layers)):
layer = self.layers[i]
Expand All @@ -269,6 +275,9 @@ def forward(
attn_metadata,
residual,
)
if current_platform.is_hpu():
htorch.core.mark_step()

hidden_states, _ = self.norm(hidden_states, residual)
return hidden_states

Expand Down

0 comments on commit f8dd294

Please sign in to comment.