Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions unsloth_zoo/vllm_lora_worker_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,18 @@ def set_active_adapters(self, requests: Set[Any],
if mapping is not None:
self._adapter_manager.set_adapter_mapping(mapping)

def get_dummy_lora_warmup_rank(self, default_rank: int) -> int:
# vLLM v1 (lora_model_runner_mixin.maybe_setup_dummy_loras) calls
# this during cudagraph warmup; delegate to the adapter manager,
# fall back to default_rank if the underlying implementation
# predates this helper.
manager_fn = getattr(
self._adapter_manager, "get_dummy_lora_warmup_rank", None
)
Comment on lines +230 to +232

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Directly accessing self._adapter_manager can raise an AttributeError if get_dummy_lora_warmup_rank is called before create_lora_manager has initialized it (since it is lazily initialized and only annotated in __init__). It is safer to use getattr(self, '_adapter_manager', None) to defensively guard against this.

        manager = getattr(self, "_adapter_manager", None)
        manager_fn = getattr(
            manager, "get_dummy_lora_warmup_rank", None
        ) if manager is not None else None

if manager_fn is not None:
return manager_fn(default_rank)
return default_rank

def supports_tower_connector_lora(self) -> bool:
manager = getattr(self, '_adapter_manager', None)
if manager is None:
Expand Down