[THUDM/ChatGLM-6B]ptuning之后api预测

2024-05-21 785 views
5

ptuning-v2微调之后模型是只保存 PrefixEncoder 部分的参数?用api.py预测是要加载原 ChatGLM-6B 模型以及 微调后的权重吗?我用以下代码加载权重,有报错 image image

ptuning-v2微调之后模型是只保存 PrefixEncoder 部分的参数?用api.py预测是要加载原 ChatGLM-6B 模型以及 微调后的权重吗?我用以下代码加载权重,有报错 image image

Environment
- OS:centos 7
- Python:3.8
- Transformers:
- PyTorch:
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :

回答

8

我也有类似的问题,用新的数据(只有一条kv数据) 加载生成的prefix_encoder数据后,原来模型的对话能力丢失了,不知道如何解决。

1

加载的时候把pre_seq_len参数传进去就好了,因为在构建模型的时候没有这个参数不会有prefix_encoder层

7

请问您加载的时候有遇到“Some weights of ChatGLMForConditionalGeneration were not initialized from the model checkpoint at ../chatglm-6b and are newly initialized: ['transformer.prefix_encoder.embedding.weight']”这个问题吗?

3

请问您加载的时候有遇到“Some weights of ChatGLMForConditionalGeneration were not initialized from the model checkpoint at ../chatglm-6b and are newly initialized: ['transformer.prefix_encoder.embedding.weight']”这个问题吗?

这是个 warning,可以忽略,后续这个参数会单独加载