FastChat icon indicating copy to clipboard operation
FastChat copied to clipboard

report error while i execute `python -m fastchat.serve.openai_api_server --host localhost --port 8000`

Open lplzyp opened this issue 1 year ago • 2 comments

1,already execute git pull 2,web model and cli mode works 3,it reports error below: /root/anaconda3/envs/fastchat/lib/python3.9/runpy.py:197 in _run_module_as_main │ │ │ │ 194 │ main_globals = sys.modules["main"].dict │ │ 195 │ if alter_argv: │ │ 196 │ │ sys.argv[0] = mod_spec.origin │ │ ❱ 197 │ return _run_code(code, main_globals, None, │ │ 198 │ │ │ │ │ "main", mod_spec) │ │ 199 │ │ 200 def run_module(mod_name, init_globals=None, │ │ │ │ /root/anaconda3/envs/fastchat/lib/python3.9/runpy.py:87 in _run_code │ │ │ │ 84 │ │ │ │ │ loader = loader, │ │ 85 │ │ │ │ │ package = pkg_name, │ │ 86 │ │ │ │ │ spec = mod_spec) │ │ ❱ 87 │ exec(code, run_globals) │ │ 88 │ return run_globals │ │ 89 │ │ 90 def _run_module_code(code, init_globals=None, │ │ │ │ /home/work/FastChat/fastchat/serve/openai_api_server.py:34 in │ │ │ │ 31 from fastchat.constants import WORKER_API_TIMEOUT, WORKER_API_EMBEDDING_BATCH_SIZE, Erro │ │ 32 from fastchat.model.model_adapter import get_conversation_template │ │ 33 from fastapi.exceptions import RequestValidationError │ │ ❱ 34 from fastchat.protocol.openai_api_protocol import ( │ │ 35 │ ChatCompletionRequest, │ │ 36 │ ChatCompletionResponse, │ │ 37 │ ChatCompletionResponseStreamChoice, │ │ │ │ /home/work/FastChat/fastchat/protocol/openai_api_protocol.py:70 in │ │ │ │ 67 │ content: str │ │ 68 │ │ 69 │ │ ❱ 70 class ChatCompletionResponseChoice(BaseModel): │ │ 71 │ index: int │ │ 72 │ message: ChatMessage │ │ 73 │ finish_reason: Optional[Literal["stop", "length"]] │ │ │ │ in pydantic.main.ModelMetaclass.new:197 │ │ │ │ in pydantic.fields.ModelField.infer:506 │ │ │ │ in pydantic.fields.ModelField.init:436 │ │ │ │ in pydantic.fields.ModelField.prepare:552 │ │ │ │ in pydantic.fields.ModelField._type_analysis:661 │ │ │ │ in pydantic.fields.ModelField._type_analysis:668 │ │ │ │ /root/anaconda3/envs/fastchat/lib/python3.9/typing.py:852 in subclasscheck │ │ │ │ 849 │ │ if isinstance(cls, _SpecialGenericAlias): │ │ 850 │ │ │ return issubclass(cls.origin, self.origin) │ │ 851 │ │ if not isinstance(cls, _GenericAlias): │ │ ❱ 852 │ │ │ return issubclass(cls, self.origin) │ │ 853 │ │ return super().subclasscheck(cls) │ │ 854 │ │ │ 855 │ def reduce(self):

How can I fix it

lplzyp avatar Jun 09 '23 06:06 lplzyp

I found a way to run this command, temporarily delete the finish_reason filed in fastchat/protocol/openai_api_protocol.py and fastchat/protocol/api_protocol.py or change it to be string, like **finish_reason: str**.

https://github.com/lm-sys/FastChat/commit/f111a6cb72a0f5e85ebdc3eec51f1c0f328602b9 in this commit version i find out the code was deleted, but it recovers right now. it is reasonable to infer the method is not correct, it may cause other bugs.

lplzyp avatar Jun 09 '23 08:06 lplzyp

could you try the latest main branch?

merrymercy avatar Jun 14 '23 10:06 merrymercy

I found a way to run this command, temporarily delete the finish_reason filed in fastchat/protocol/openai_api_protocol.py and fastchat/protocol/api_protocol.py or change it to be string, like **finish_reason: str**.

https://github.com/lm-sys/FastChat/commit/f111a6cb72a0f5e85ebdc3eec51f1c0f328602b9 in this commit version i find out the code was deleted, but it recovers right now. it is reasonable to infer the method is not correct, it may cause other bugs.

how did you fix. ihave the same problems

chengming1108 avatar Jul 25 '23 07:07 chengming1108

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

lplzyp avatar Jul 25 '23 07:07 lplzyp

@chengming1108 did you manage it?

surak avatar Nov 03 '23 12:11 surak