From 84b9d38e283772fb84bb6c0470e9ee12b0027ce4 Mon Sep 17 00:00:00 2001 From: Mercykid-bash Date: Fri, 12 Dec 2025 14:55:26 +0800 Subject: [PATCH] BugFix: Resolve PolicyFlashlb warm up function attribute error (#4741) ## Description Fix the AttributeError caused by incorrect invocation of the warm-up function in the FlashLB algorithm: 1. **Root Cause**: The warm-up function for FlashLB is defined outside the `PolicyFlashlb` class (not a class method), but the code incorrectly attempted to call it via the `PolicyFlashlb` class instance. 2. **Key Fix**: Clarify the invocation rule for FlashLB: when selecting the FlashLB algorithm, the warm-up function must be called in advance to precompile and warm up the algorithm (invoked as a standalone function), instead of calling it through the `PolicyFlashlb` class. 3. **Impact**: Resolve the runtime error when using FlashLB, ensure the algorithm pre-compilation/warm-up process works as expected, and avoid attribute missing exceptions. Signed-off-by: Mercykid-bash --- vllm_ascend/eplb/core/policy/policy_factory.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vllm_ascend/eplb/core/policy/policy_factory.py b/vllm_ascend/eplb/core/policy/policy_factory.py index bbf7315e..104d14c9 100644 --- a/vllm_ascend/eplb/core/policy/policy_factory.py +++ b/vllm_ascend/eplb/core/policy/policy_factory.py @@ -3,7 +3,7 @@ from .policy_abstract import DynamicConfig, EplbPolicy from .policy_dynamic_ep import DynamicEplb from .policy_dynamic_ep_v2 import DynamicEplbV2 -from .policy_flashlb import FlashLB +from .policy_flashlb import FlashLB, warm_up from .policy_random import RandomLoadBalance @@ -29,5 +29,5 @@ class PolicyFactory: policy_class = policy.get(policy_type, RandomLoadBalance) policy_instance = policy_class(config) if policy_type == 3: - policy_instance.warm_up() - return policy_instance \ No newline at end of file + warm_up() + return policy_instance