Fix LoRA support for multimodal models (VLMs) by implementing a consistent pattern for skipping vision components (#11261)

This commit is contained in:
Chenxi Li
2025-10-06 17:23:00 -07:00
committed by GitHub
parent a57f0e3d56
commit afc35ccc5e
3 changed files with 26 additions and 8 deletions
-8
View File
@@ -418,10 +418,6 @@ class LoRAManager:
replace_submodule(self.base_model, module_name, lora_module)
return lora_module
def should_skip_lora_for_vision_model(self, module_name):
# TODO: support different vision models
return module_name.find("vision_model.model") != -1
def init_lora_modules(self):
# Look-up table that essentially maps (layer_index, module_name) to the corresponding LoRA module.
self.lora_modules: List[Dict[str, BaseLayerWithLoRA]] = [
@@ -439,10 +435,6 @@ class LoRAManager:
) and not self.base_model.should_apply_lora(module_name):
continue
# Skip vision model
if self.should_skip_lora_for_vision_model(module_name):
continue
# The module should be converted if it is included in target_names
if module_name.split(".")[-1] in self.target_modules:
layer_id = get_layer_id(module_name)