Skip to content

Commit

Permalink
[Misc] Change dummy profiling and BOS fallback warns to log once (vll…
Browse files Browse the repository at this point in the history
…m-project#8820)

Signed-off-by: Sumit Dubey <sumit.dubey2@ibm.com>
  • Loading branch information
mgoin authored and sumitd2 committed Nov 14, 2024
1 parent 79ad521 commit c66ce70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 8 additions & 6 deletions vllm/inputs/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from vllm.lora.request import LoRARequest
from vllm.prompt_adapter.request import PromptAdapterRequest
from vllm.transformers_utils.tokenizer_group import BaseTokenizerGroup
from vllm.utils import print_warning_once

from .data import (EncoderDecoderLLMInputs, LLMInputs, PromptInputs,
SingletonPromptInputs)
Expand Down Expand Up @@ -71,20 +72,21 @@ def get_decoder_start_token_id(self) -> Optional[int]:
'''

if not self.is_encoder_decoder_model():
logger.warning("Using None for decoder start token id because "
"this is not an encoder/decoder model.")
print_warning_once("Using None for decoder start token id because "
"this is not an encoder/decoder model.")
return None

if (self.model_config is None or self.model_config.hf_config is None):
logger.warning("Using None for decoder start token id because "
"model config is not available.")
print_warning_once("Using None for decoder start token id because "
"model config is not available.")
return None

dec_start_token_id = getattr(self.model_config.hf_config,
'decoder_start_token_id', None)
if dec_start_token_id is None:
logger.warning("Falling back on <BOS> for decoder start token id "
"because decoder start token id is not available.")
print_warning_once("Falling back on <BOS> for decoder start token "
"id because decoder start token id is not "
"available.")
dec_start_token_id = self.get_bos_token_id()

return dec_start_token_id
Expand Down
8 changes: 4 additions & 4 deletions vllm/inputs/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing_extensions import TypeVar

from vllm.logger import init_logger
from vllm.utils import get_allowed_kwarg_only_overrides
from vllm.utils import get_allowed_kwarg_only_overrides, print_warning_once

from .data import LLMInputs

Expand Down Expand Up @@ -235,9 +235,9 @@ def dummy_data_for_profiling(
num_tokens = seq_data.prompt_token_ids
if len(num_tokens) < seq_len:
if is_encoder_data:
logger.warning(
"Expected at least %d dummy encoder tokens for profiling, "
"but found %d tokens instead.", seq_len, len(num_tokens))
print_warning_once(
f"Expected at least {seq_len} dummy encoder tokens for "
f"profiling, but found {len(num_tokens)} tokens instead.")
else:
raise AssertionError(
f"Expected at least {seq_len} dummy tokens for profiling, "
Expand Down

0 comments on commit c66ce70

Please sign in to comment.