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

[BUG/Help] <title>chatglm-6b-int4, ptuning之后推理, 从chat换成generate后得到的输出为空 #1452

Open
1 task done
dzhengxin opened this issue Jan 29, 2024 · 0 comments

Comments

@dzhengxin
Copy link

dzhengxin commented Jan 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

chat正常有response, 但generate结果打印出来 token_id只比输入多了一个 5, 解码后为空
chat单句推理正常,改成generate进行单句推理/批量推理结果都为空

inputs = self._tokenizer(text_list, padding=True, return_tensors="pt")
inputs = inputs.to(self._model.device)
outputs = self._model.generate(
**inputs,
max_length=512,
do_sample=False)

两种decode都为空
llm_outputs = list()
for j, output in enumerate(outputs.tolist()):
index = len(inputs["input_ids"][j])
output1 = output[index:]
response = self._tokenizer.decode(output1, skip_special_tokens=True)
llm_outputs.append(response)

llm_outputs2 = self._tokenizer.batch_decode(outputs)

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

1 participant