Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port not warmed-up configurations log warnings #222

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 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: (', phase, ', ', batch_size, ', ',
seq_len, ') was not warmed-up!')

@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 All @@ -1604,10 +1615,7 @@ def execute_model(
if multi_modal_input is not None:
execute_model_kwargs.update(multi_modal_input)
if htorch.utils.internal.is_lazy():
execute_model_kwargs.update({
"bypass_hpu_graphs": not use_graphs,
"warmup_mode": warmup_mode
})
execute_model_kwargs.update({"bypass_hpu_graphs": not use_graphs})
adobrzyniewicz-habana marked this conversation as resolved.
Show resolved Hide resolved

htorch.core.mark_step()
if self.is_driver_worker:
Expand Down
Loading