Skip to content

Commit

Permalink
Port not warmed-up configurations log warnings (#222)
Browse files Browse the repository at this point in the history
From: #94
  • Loading branch information
adobrzyniewicz-habana authored Sep 2, 2024
2 parents 221eb56 + 4eedfb9 commit 2897805
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vllm/worker/habana_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ def __init__(

# Profiler stats
self.profiler_counter_helper = HabanaProfilerCounterHelper()
self.seen_configs: set = set()
self._mem_margin: Optional[int] = None
self._setup_buckets()

Expand Down Expand Up @@ -1560,6 +1561,15 @@ def finish_measurements(self):
from neural_compressor.torch.quantization import finalize_calibration
finalize_calibration(self.model.model)

def _check_config(self, batch_size, seq_len, is_prompt, warmup_mode):
cfg = (batch_size, seq_len, is_prompt)
seen = cfg in self.seen_configs
self.seen_configs.add(cfg)
if not seen and not warmup_mode:
phase = 'prompt' if is_prompt else 'decode'
logger.warning("Configuration: (%s, %s, %s) was not warmed-up!",
phase, batch_size, seq_len)

@torch.inference_mode()
def execute_model(
self,
Expand Down Expand Up @@ -1594,6 +1604,7 @@ def execute_model(
batch_size = input_tokens.size(0)
seq_len = self._seq_len(attn_metadata)
use_graphs = self._use_graphs(batch_size, seq_len, is_prompt)
self._check_config(batch_size, seq_len, is_prompt, warmup_mode)
execute_model_kwargs = {
"input_ids": input_tokens,
"positions": input_positions,
Expand Down

0 comments on commit 2897805

Please sign in to comment.