From 6c58d38e9e14b2eafb71940927bae34bb229bae1 Mon Sep 17 00:00:00 2001 From: qianyu chen <38046403+qyc-98@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:10:36 +0800 Subject: [PATCH] Update readme.md --- finetune/readme.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/finetune/readme.md b/finetune/readme.md index c656c0d..4fe6026 100644 --- a/finetune/readme.md +++ b/finetune/readme.md @@ -80,12 +80,18 @@ sh finetune_lora.sh After training, you could load the model with the path to the adapter. We advise you to use absolute path for your pretrained model. This is because LoRA only saves the adapter and the absolute path in the adapter configuration json file is used for finding out the pretrained model to load. ``` -from peft import AutoPeftModel - +from peft import PeftModel +from transformers import AutoModel +model_type="openbmb/MiniCPM-Llama3-V-2_5" # or openbmb/MiniCPM-V-2 path_to_adapter="path_to_your_fine_tuned_checkpoint" -model = AutoPeftModel.from_pretrained( - # path to the output directory +model = AutoModel.from_pretrained( + model_type, + trust_remote_code=True + ) + +lora_model = PeftModel.from_pretrained( + model, path_to_adapter, device_map="auto", trust_remote_code=True