I am currently looking into doing SFT fine-tuning of a VLLM using this guide provided: Fine-tuning a Multimodal Model Using SFT (Single or Multi-Image Dataset) , and I realised that the Lora config mentioned is just using the “all-linear” target_modules like such:
peft_config = LoraConfig(
lora_alpha=16,
lora_dropout=0.05,
r=16,
bias="none",
target_modules="all-linear",
task_type="CAUSAL_LM",
modules_to_save=[
"lm_head",
"embed_tokens",
],
)
Just curious, is there a way to apply the target_modules to these
["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"]
and I only want it to be effected to only the language model layers?
Currently, I tried doing this:
model = "google/gemma-3-4b-it"
layer_pattern_name = "model.language_model.layers"
peft_config = LoraConfig(
lora_alpha=16,
lora_dropout=0.05,
r=16,
bias="none",
target_modules=["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"],
layers_to_transform = [i for i in range(len(eval(layer_pattern_name)))],
layer_pattern_name=layer_pattern_name,
task_type="CAUSAL_LM"
)
But I got this error message when passing this config to SFTTrainer
ValueError: Target modules {‘q_proj’, ‘up_proj’, ‘down_proj’, ‘gate_proj’, ‘o_proj’, ‘v_proj’, ‘k_proj’} not found in the base model. Please check the target modules and try again. Note: You specified ‘layers_to_transform’: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]. You also specified ‘layers_pattern’: model.language_model.layers.
Wondering if anyone has had the same issue. Thank you!