Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError: Provided path (dbgpt_hub/output/adapter/llama3-sqlcoder-lora) does not contain a LoRA weight. #281

Open
zhangsone opened this issue Aug 14, 2024 · 2 comments

Comments

@zhangsone
Copy link

进行模型预测时报错,以下是预测参数:
CUDA_VISIBLE_DEVICES=0,2 python dbgpt_hub/predict/predict.py
--model_name_or_path /data/nfsshare/llama-3-sqlcoder-8b-bak/app/model
--template llama2
--finetuning_type lora
--predicted_input_filename dbgpt_hub/data/pred/text2sql_列表类.json
--checkpoint_dir dbgpt_hub/output/adapter/llama3-sqlcoder-lora
--predicted_out_filename dbgpt_hub/output/pred/pred_列表类.sql >> ${pred_log}

训练的时候也是采用lora的训练方式

@Emir-Liu
Copy link

Emir-Liu commented Sep 9, 2024

这个应该是因为,训练的结果是用safetensor保存的,但是预测模型的时候,却使用了bin格式进行加载,导致文件不匹配。

训练方式,codellama模型,不使用deepspeed,使用sft训练

ref:huggingface/safetensors#397 (comment)

@ychuest
Copy link

ychuest commented Oct 8, 2024

用下面的代码转换一下(亲测有效):
from safetensors.torch import load_file
import torch
lora_model_path = 'adapter_model.safetensors'
bin_model_path = 'adapter_model.bin'

torch.save(load_file(lora_model_path), bin_model_path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants