Edit model card
  • 使用lora对Qwen-14b-chat模型进行微调,使其能适应32k长度的上下文(目前仅支持中文)。
  • 此项目仅提供lora参数,需要自行合并后使用。

如何将lora参数合并到Qwen模型中

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation import GenerationConfig
from peft import PeftModel

tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen-14B-Chat", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-14B-Chat", device_map="auto", trust_remote_code=True, bf16=True).eval()

model=PeftModel.from_pretrained(model,"path_to_lora_weight")
model=model.merge_and_unload()
model.save_pretrained("save_path")
Downloads last month
0
Unable to determine this model's library. Check the docs .