Update merge.py
This commit is contained in:
parent
8573e491a1
commit
360c365eb6
1 changed files with 3 additions and 5 deletions
8
merge.py
8
merge.py
|
@ -4,8 +4,8 @@ import json
|
||||||
import torch
|
import torch
|
||||||
import argparse
|
import argparse
|
||||||
import transformers
|
import transformers
|
||||||
from transformers import LlamaTokenizer, LlamaConfig, LlamaForCausalLM
|
from transformers import LlamaTokenizer, LlamaForCausalLM
|
||||||
from peft import PeftModel, LoraConfig, LoraModel
|
from peft import PeftModel
|
||||||
|
|
||||||
# args
|
# args
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
@ -45,9 +45,7 @@ model = PeftModel.from_pretrained(
|
||||||
|
|
||||||
print(f">>> merging lora...")
|
print(f">>> merging lora...")
|
||||||
|
|
||||||
#Why 'LlamaForCausalLM' object has no attribute 'merge_and_unload' ????????
|
#Using new Peft function merge Lora
|
||||||
#okay, it works, i don't know why it didn't.
|
|
||||||
|
|
||||||
model = model.merge_and_unload()
|
model = model.merge_and_unload()
|
||||||
model.save_pretrained(args.out_path)
|
model.save_pretrained(args.out_path)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue