Skip to content

Commit

Permalink
Move make empty intermediate tensors to warmup_scenario.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaksymczuk committed Sep 23, 2024
1 parent 50faef5 commit 0bbe6fb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions vllm/worker/habana_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,13 @@ def warmup_scenario(self,
profiler.start()
for _ in range(times):
inputs = self.prepare_model_input(seqs)
self.execute_model(inputs, kv_caches, warmup_mode=True)
intermediate_tensors = None
if not get_pp_group().is_first_rank:
intermediate_tensors = self.model.make_empty_intermediate_tensors(
batch_size=batch_size,
dtype=self.model_config.dtype,
device=self.device)
self.execute_model(inputs, kv_caches, intermediate_tensors=intermediate_tensors, warmup_mode=True)
torch.hpu.synchronize()
if profiler:
profiler.step()
Expand Down Expand Up @@ -1813,12 +1819,6 @@ def execute_model(
use_graphs = self._use_graphs(batch_size, seq_len, is_prompt)
self._check_config(batch_size, seq_len, is_prompt, warmup_mode)

if not get_pp_group().is_first_rank:
intermediate_tensors = self.model.make_empty_intermediate_tensors(
batch_size=batch_size,
dtype=self.model_config.dtype,
device=self.device)

execute_model_kwargs = {
"input_ids": input_tokens,
"positions": input_positions,
Expand Down

0 comments on commit 0bbe6fb

Please sign in to comment.