Fix lightweight-serving codegeex error (#11759)

This commit is contained in:
Wang, Jian4 2024-08-12 10:35:37 +08:00 committed by GitHub
parent 66fe2ee464
commit 245dba0abc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -275,11 +275,11 @@ def get_prompt(messages) -> str:
if len(messages) <= 1: if len(messages) <= 1:
history = [] history = []
else: else:
history = [msg.model_dump() for msg in messages[:-1]] history = [msg for msg in messages[:-1]]
history.append({"role": "user", "content": query}) history.append({"role": "user", "content": query})
inputs = tokenizer.apply_chat_template(history, add_generation_prompt=True, tokenize=False, inputs = tokenizer.apply_chat_template(history, add_generation_prompt=True, tokenize=False,
return_tensors="pt", return_dict=False) return_tensors="pt", return_dict=False)
return inputs return inputs, []
else: else:
prompt = "" prompt = ""
image_list = [] image_list = []