A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 6, 10:45 UTC
[LoRA] Minor improvements to LoRA log (#37557)
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com> Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Jee Jee Li committed
Mar 19, 2026 at 23:18 UTC
96266f119bb93516703328f9e37ec99cce45f792
1 file changed
+37
-13
vllm/lora/model_manager.py
+37
-13
@@ -164,23 +164,44 @@ class LoRAModelManager:
164
165
lm_prefix = self.mm_mapping.language_model[0]
166
self.punica_wrapper_mapping[lm_prefix] = llm_punica_wrapper
167
- if self.lora_config.enable_tower_connector_lora:
168
- self.supports_tower_connector_lora = self.supports_mm and hasattr(
169
- self.model, "get_num_mm_encoder_tokens"
170
- )
167
+
168
+ # First, determine if the model supports tower connector LoRA.
169
+ self.supports_tower_connector_lora = self.supports_mm and hasattr(
170
+ self.model, "get_num_mm_encoder_tokens"
171
+ )
172
+
173
+ # Then, handle the case where the feature is disabled in the config.
174
+ if not self.lora_config.enable_tower_connector_lora:
175
+ if self.supports_tower_connector_lora:
176
+ logger.info(
177
+ "%s supports adding LoRA to the tower modules. If needed, "
178
+ "please set `enable_tower_connector_lora=True`.",
179
+ self.model.__class__.__name__,
180
+ )
181
+ self.supports_tower_connector_lora = False
182
+ return
183
+
184
+ # After this point, the feature is enabled in the config.
185
+ # Now check if it's supported by the model.
186
if not self.supports_tower_connector_lora:
187
+ # Enabled but not supported: log warning and return.
188
+ logger.warning(
189
+ "LoRA with tower connector is enabled, but the model %s "
190
+ "does not support it. This will be ignored.",
191
+ self.model.__class__.__name__,
192
+ )
193
return
194
195
+ # Check if initialize the language model only.
196
if (
197
vllm_config.model_config.multimodal_config
198
and vllm_config.model_config.multimodal_config.language_model_only
199
):
178
- if self.supports_tower_connector_lora:
179
- logger.warning(
180
- "Disabling `enable_tower_connector_lora` because the multimodal "
181
- "model is configured to initialize the language model only."
182
- )
183
- self.supports_tower_connector_lora = False
200
+ logger.warning(
201
+ "Disabling `enable_tower_connector_lora` because the multimodal "
202
+ "model is configured to initialize the language model only."
203
+ )
204
+ self.supports_tower_connector_lora = False
205
return
206
207
logger.warning(
@@ -269,6 +290,9 @@ class LoRAModelManager:
290
module_lora = self._get_lora_layer_weights(lora_model, module_name)
291
if not module_lora:
292
module.reset_lora(index)
293
+ logger.debug(
294
+ "No LoRA weights found for module %s, skipping.", module_name
295
+ )
296
continue
297
298
module.set_lora(
@@ -276,7 +300,7 @@ class LoRAModelManager:
300
module_lora.lora_a,
301
module_lora.lora_b,
302
)
279
-
303
+ logger.debug("Successfully loaded LoRA weights for module %s.", module_name)
304
return True
305
306
def _deactivate_adapter(self, lora_id: int):
@@ -346,8 +370,8 @@ class LoRAModelManager:
370
punica_wrapper = self._get_punica_wrapper(module_name)
371
if punica_wrapper is None:
372
logger.warning(
349
- "Regarding %s, vLLM currently only supports adding LoRA to"
350
- " language model, %s will be ignored.",
373
+ "Regarding %s, no matching PunicaWrapper "
374
+ "is found; %s will be ignored.",
375
self.model.__class__.__name__,
376
module_name,
377
)