Signed-off-by: bk-201 <joy25810@foxmail.com>
This commit is contained in:
bk-201 2025-10-13 02:39:01 +00:00
parent 0fa9111e82
commit 882213cca2
3 changed files with 8 additions and 5 deletions

View File

@ -336,7 +336,7 @@ class LoRAModelManager:
max_num_batched_tokens: int, max_num_batched_tokens: int,
vocab_size: int, vocab_size: int,
lora_config: LoRAConfig, lora_config: LoRAConfig,
model_config: Optional[ModelConfig], model_config: ModelConfig | None,
device: torch.device, device: torch.device,
): ):
"""Create a LoRAModelManager and adapter for a given model. """Create a LoRAModelManager and adapter for a given model.
@ -709,7 +709,7 @@ class LoRAModelManager:
return any([module_name.startswith(prefix) for prefix in prefix_lst]) return any([module_name.startswith(prefix) for prefix in prefix_lst])
return False return False
def _get_mm_punica_wrapper(self, module_name: str) -> Optional[PunicaWrapperBase]: def _get_mm_punica_wrapper(self, module_name: str) -> PunicaWrapperBase | None:
""" """
Match the corresponding punica_wrapper based on module_name, Match the corresponding punica_wrapper based on module_name,
and return None if lora is not supported for this module. and return None if lora is not supported for this module.

View File

@ -71,7 +71,7 @@ class WorkerLoRAManager:
def create_lora_manager( def create_lora_manager(
self, self,
model: torch.nn.Module, model: torch.nn.Module,
model_config: Optional[ModelConfig] = None, model_config: ModelConfig | None = None,
) -> Any: ) -> Any:
lora_manager = create_lora_manager( lora_manager = create_lora_manager(
model, model,
@ -222,7 +222,7 @@ class LRUCacheWorkerLoRAManager(WorkerLoRAManager):
def create_lora_manager( def create_lora_manager(
self, self,
model: torch.nn.Module, model: torch.nn.Module,
model_config: Optional[ModelConfig] = None, model_config: ModelConfig | None = None,
) -> Any: ) -> Any:
lora_manager = create_lora_manager( lora_manager = create_lora_manager(
model, model,

View File

@ -131,7 +131,10 @@ class LoRAModelRunnerMixin:
@contextmanager @contextmanager
def maybe_select_dummy_loras( def maybe_select_dummy_loras(
self, lora_config: LoRAConfig | None, num_scheduled_tokens: np.ndarray, is_mm_input: bool = False self,
lora_config: LoRAConfig | None,
num_scheduled_tokens: np.ndarray,
is_mm_input: bool = False,
): ):
if lora_config is None: if lora_config is None:
yield yield