diff --git a/python/sglang/srt/managers/scheduler_output_processor_mixin.py b/python/sglang/srt/managers/scheduler_output_processor_mixin.py index ae6f732fe..ea2c38c0d 100644 --- a/python/sglang/srt/managers/scheduler_output_processor_mixin.py +++ b/python/sglang/srt/managers/scheduler_output_processor_mixin.py @@ -75,7 +75,7 @@ class SchedulerOutputProcessorMixin: "host": req.cached_tokens_host, } # Only include storage fields if L3 storage is enabled - if getattr(self, "enable_hicache_storage", False): + if self.enable_hicache_storage: details["storage"] = req.cached_tokens_storage details["storage_backend"] = self._get_storage_backend_type() return details diff --git a/python/sglang/srt/managers/scheduler_pp_mixin.py b/python/sglang/srt/managers/scheduler_pp_mixin.py index 939c83f3c..0b2270ce9 100644 --- a/python/sglang/srt/managers/scheduler_pp_mixin.py +++ b/python/sglang/srt/managers/scheduler_pp_mixin.py @@ -717,7 +717,7 @@ class SchedulerPPMixin: ): return None - max_chunk_size = getattr(self, "max_prefill_tokens", None) + max_chunk_size = self.max_prefill_tokens predicted_size = self.length_predictor.predict_next_chunk_size( history_len=history_len, base_chunk_size=self.chunked_prefill_size, diff --git a/python/sglang/srt/managers/tokenizer_manager_score_mixin.py b/python/sglang/srt/managers/tokenizer_manager_score_mixin.py index d8b0b1753..6d5475517 100644 --- a/python/sglang/srt/managers/tokenizer_manager_score_mixin.py +++ b/python/sglang/srt/managers/tokenizer_manager_score_mixin.py @@ -261,7 +261,7 @@ class TokenizerManagerScoreMixin: has_phs = False prompt_tokens = 0 - is_generation = getattr(self, "is_generation", True) + is_generation = self.is_generation if is_generation: for result in results: # For single-item scoring, logprobs are in output_token_ids_logprobs @@ -563,7 +563,7 @@ class TokenizerManagerScoreMixin: return_pooled_hidden_states=True and the model supports it; None otherwise. """ - is_generation = getattr(self, "is_generation", True) + is_generation = self.is_generation if is_generation and label_token_ids is None: raise ValueError( @@ -676,7 +676,7 @@ class TokenizerManagerScoreMixin: "It requires a model with a task-specific head " "(e.g. SequenceClassification or RewardModel)." ) - model_config = getattr(self, "model_config", None) + model_config = self.model_config if model_config is not None: archs = getattr(model_config.hf_config, "architectures", []) or [] if is_cross_encoding_pooler_model(archs):