[THUDM/ChatGLM-6B][BUG/Help] 使用main.py进行全量微调训练后,输出一直为空

2024-05-20 658 views
6

from transformers import AutoModel, AutoTokenizer import sys

local_model_path = "my_local_checkpoint_path"

model_path = "THUDM/chatglm-6b" # You can modify the path for storing the local model

model = AutoModel.from_pretrained(local_model_path, trust_remote_code=True) tokenizer = AutoTokenizer.from_pretrained(local_model_path, trust_remote_code=True) response, history = model.chat(tokenizer, "你好", history=[]) print("\033[1;36m" + "chatGLM:{}".format(response) + "\033[0m")

line = input("Human:") while line: response, history = model.chat(tokenizer, str(line), history=[]) print("\033[1;36m"+"chatGLM:{}".format(response)+"\033[0m")

print('\033[42m'+"chatGLM:{}"+'\033[42m'.format(response))
line = input("Human:")
# print(line)

我使用main.py进行了全量微调,重新加载模型发现直接不输出了,什么输出都为空。

Expected Behavior

No response

Steps To Reproduce

使用了main.py在我自己的数据集上进行了训练,使用trainer.save_model()保存了训练后的模型

Environment
- OS:centos7
- Python:3.8.13
- Transformers:4.28.0.dev0
- PyTorch: 1.13.0
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) : 11.7

回答

7

遇到同样的问题,请问有解决方案吗?

2

遇到同样的问题,请问有解决方案吗?

或许是数据的格式问题,我之后没有使用chatglm了,在用llama

6

遇到同样的问题,请问有解决方案吗?

或许是数据的格式问题,我之后没有使用chatglm了,在用llama

为什么会觉得是数据格式的问题呢?都是参考给定的数据结构,修改了数据集字段做训练的,应该没问题的

9

遇到同样的问题,请问有解决方案吗?

或许是数据的格式问题,我之后没有使用chatglm了,在用llama

为什么会觉得是数据格式的问题呢?都是参考给定的数据结构,修改了数据集字段做训练的,应该没问题的

数据格式很重要, 输出空是因为模型认为你的输入以及不需要补充了,建议类似格式,让模型知道你要让他输出结果:

Human:{你的prompt} Asisstant: