Open ihavework7 opened 7 months ago
The error you're encountering, ValueError: Target modules ['q_proj', 'k_proj', 'v_proj'] not found in the base model, suggests that the PEFT configuration is looking for certain layers in the model that are named differently or do not exist.
Given your model structure, it looks like the quantized model has replaced the standard projection layers (q_proj, k_proj, v_proj) with qkv_proj in FusedLlamaAttentionForQuantizedModel.
possible solution:-
example snippet:-
from transformers import AutoTokenizer
from auto_gptq import AutoGPTQForCausalLM
from peft import PeftModel, LoraConfig, get_peft_model, prepare_model_for_kbit_training
def load_model(base_model, peft_model, from_remote=True):
model_name = parse_model_name(base_model, from_remote)
model_name_or_path = "TheBloke/Llama-2-7b-Chat-GPTQ"
model = AutoGPTQForCausalLM.from_quantized(
model_name_or_path,
model_basename="model",
use_safetensors=True,
trust_remote_code=True,
device="cuda:0",
use_triton="False"
)
model.model_parallel = True
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
# Define the new target modules for PEFT
peft_config = LoraConfig(
r=8,
lora_alpha=32,
target_modules=["qkv_proj"], # Adjusted target module
lora_dropout=0.1,
bias="none",
task_type="CAUSAL_LM"
)
# Prepare model for PEFT with the new configuration
model = prepare_model_for_kbit_training(model)
model = get_peft_model(model, peft_config)
model = PeftModel.from_pretrained(model, peft_model)
model = model.eval()
return model, tokenizer
# Rest of your code
hope this helps, Thanks
Hello. I have been trying to run the multi task llama7b models with Bloke's llama 7b GPTQ(https://huggingface.co/TheBloke/Llama-2-7B-GPTQ) as the base.
While running the same in google colab, I get the error when trying to load PEFT from pre trained:
After a bit of searching, It says I'll have to re train the PEFT model by using a different config. Is there anything I can do? (other than training)
For debugging purposes, value of 'model' before PEFT is used: