Clean up noisy startup warnings from third-party deps (#23669)
This commit is contained in:
@@ -10,7 +10,7 @@ from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
||||
import numpy as np
|
||||
import torch
|
||||
from PIL import Image
|
||||
from transformers import BaseImageProcessorFast
|
||||
from transformers import BaseImageProcessor
|
||||
|
||||
from sglang.srt.managers.schedule_batch import (
|
||||
Modality,
|
||||
@@ -428,7 +428,7 @@ class BaseMultimodalProcessor(ABC):
|
||||
processor = self._processor
|
||||
if (
|
||||
hasattr(processor, "image_processor")
|
||||
and isinstance(processor.image_processor, BaseImageProcessorFast)
|
||||
and isinstance(processor.image_processor, BaseImageProcessor)
|
||||
and not self.server_args.disable_fast_image_processor
|
||||
):
|
||||
if _is_cpu or get_global_server_args().rl_on_policy_target is not None:
|
||||
|
||||
@@ -7,7 +7,7 @@ import torch
|
||||
import torchvision
|
||||
from PIL import Image
|
||||
from torchvision.transforms import InterpolationMode
|
||||
from transformers import BaseImageProcessorFast
|
||||
from transformers import BaseImageProcessor
|
||||
|
||||
from sglang.srt.environ import envs
|
||||
from sglang.srt.layers.rotary_embedding import MRotaryEmbedding
|
||||
@@ -302,7 +302,7 @@ class Ernie4_5_VLImageProcessor(SGLangBaseProcessor):
|
||||
processor = self._processor
|
||||
if (
|
||||
hasattr(processor, "image_processor")
|
||||
and isinstance(processor.image_processor, BaseImageProcessorFast)
|
||||
and isinstance(processor.image_processor, BaseImageProcessor)
|
||||
and not self.server_args.disable_fast_image_processor
|
||||
):
|
||||
if not _is_npu:
|
||||
|
||||
@@ -233,7 +233,7 @@ class KimiGPUProcessorWrapper:
|
||||
self._gpu_norm_tensors = None
|
||||
|
||||
# Explicitly expose attributes that base class process_mm_data needs:
|
||||
# - image_processor: checked via isinstance(..., BaseImageProcessorFast)
|
||||
# - image_processor: checked via isinstance(..., BaseImageProcessor)
|
||||
# - tokenizer: used for tokenization
|
||||
# - media_processor: used by CPU fallback path
|
||||
self.image_processor = hf_processor.image_processor
|
||||
|
||||
@@ -90,7 +90,7 @@ def _resolve_platform() -> SRTPlatform:
|
||||
logger.exception("Failed to activate platform plugin: %s", name)
|
||||
|
||||
if len(activated) == 0:
|
||||
logger.warning("No platform detected. Using base SRTPlatform with defaults.")
|
||||
logger.debug("No platform detected. Using base SRTPlatform with defaults.")
|
||||
return SRTPlatform()
|
||||
|
||||
if len(activated) == 1:
|
||||
|
||||
@@ -217,16 +217,13 @@ def get_hf_text_config(config: PretrainedConfig):
|
||||
|
||||
# Some models (e.g. DeepSeek-OCR) store sub-configs as plain dicts.
|
||||
# Convert to PretrainedConfig early so hasattr() checks and asserts work.
|
||||
parent_dtype = getattr(config, "torch_dtype", None)
|
||||
parent_dtype = getattr(config, "dtype", None)
|
||||
for _attr in ("text_config", "llm_config", "language_config", "thinker_config"):
|
||||
_sub = getattr(config, _attr, None)
|
||||
if isinstance(_sub, dict):
|
||||
_converted = PretrainedConfig(**_sub)
|
||||
if (
|
||||
getattr(_converted, "torch_dtype", None) is None
|
||||
and parent_dtype is not None
|
||||
):
|
||||
_converted.torch_dtype = parent_dtype
|
||||
if getattr(_converted, "dtype", None) is None and parent_dtype is not None:
|
||||
_converted.dtype = parent_dtype
|
||||
setattr(config, _attr, _converted)
|
||||
|
||||
# Priority: thinker_config > llm_config > language_config > text_config
|
||||
@@ -236,8 +233,8 @@ def get_hf_text_config(config: PretrainedConfig):
|
||||
if hasattr(thinker_config, "text_config"):
|
||||
setattr(
|
||||
thinker_config.text_config,
|
||||
"torch_dtype",
|
||||
getattr(thinker_config, "torch_dtype", None),
|
||||
"dtype",
|
||||
getattr(thinker_config, "dtype", None),
|
||||
)
|
||||
text_config = thinker_config.text_config
|
||||
else:
|
||||
|
||||
@@ -222,7 +222,19 @@ def _patch_removed_symbols():
|
||||
"""
|
||||
# LlamaFlashAttention2
|
||||
try:
|
||||
from transformers.models.llama import modeling_llama
|
||||
import logging
|
||||
|
||||
# Importing modeling_llama triggers a deep import chain:
|
||||
# modeling_llama -> modeling_utils -> quantizers -> torchao
|
||||
# torchao emits a noisy warning about incompatible torch versions
|
||||
# that is irrelevant here — suppress it during this import.
|
||||
_torchao_logger = logging.getLogger("torchao")
|
||||
_prev_level = _torchao_logger.level
|
||||
_torchao_logger.setLevel(logging.ERROR)
|
||||
try:
|
||||
from transformers.models.llama import modeling_llama
|
||||
finally:
|
||||
_torchao_logger.setLevel(_prev_level)
|
||||
|
||||
if not hasattr(modeling_llama, "LlamaFlashAttention2"):
|
||||
if hasattr(modeling_llama, "LlamaAttention"):
|
||||
|
||||
Reference in New Issue
Block a user