binary-husky / gpt_academic

为GPT/GLM等LLM大语言模型提供实用化交互接口,特别优化论文阅读/润色/写作体验,模块化设计,支持自定义快捷按钮&函数插件,支持Python和C++等项目剖析&自译解功能,PDF/LaTex论文翻译&总结功能,支持并行问询多种LLM模型,支持chatglm3等本地模型。接入通义千问, deepseekcoder, 讯飞星火, 文心一言, llama2, rwkv, claude2, moss等。
https://github.com/binary-husky/gpt_academic/wiki/online
GNU General Public License v3.0
65.55k stars 8.06k forks source link

[Feature]: 用 Oobabooga/text-generation-webui 加载模型 #823

Closed fz68 closed 10 months ago

fz68 commented 1 year ago

Class | 类型

None

Feature Request | 功能请求

可以使用 Oobabooga/text-generation-webui 作为后端, 使用它的API去访问,这样可以支持各种模型

binary-husky commented 1 year ago

之前写过一部分了https://github.com/binary-husky/gpt_academic/blob/master/request_llm/bridge_tgui.py

不过有一段时间text-generation-webui的api功能不稳定,所以一直搁置到现在

Pb-207 commented 1 year ago

现在Oobabooga/text-generation-webui已有仿OpenAi的API后端,但需要配置变量OPENAI_API_BASE=http://127.0.0.1:5001/v1,应该在已有的代码上稍作修改即可

dalerxli commented 1 year ago

您好!您的邮件已收到,谢谢。

Pb-207 commented 1 year ago

之前写过一部分了https://github.com/binary-husky/gpt_academic/blob/master/request_llm/bridge_tgui.py

不过有一段时间text-generation-webui的api功能不稳定,所以一直搁置到现在 现在Oobabooga/text-generation-webui已有仿OpenAi的API后端,但需要配置变量OPENAI_API_BASE=http://127.0.0.1:5001/v1,应该在已有的代码上稍作修改即可。

尝试修改了bridge_all.py的重定向部分为:

Endpoint 重定向

API_URL_REDIRECT, = get_conf("API_URL_REDIRECT") openai_endpoint = "http://127.0.0.1:5001/v1/chat/completions" api2d_endpoint = "http://127.0.0.1:5001/v1/chat/completions"

现在能正常向text-gen-ui的openai api发送请求并接受响应,但响应的json不能被正确解析,报错: Traceback (most recent call last): File ".\request_llm\bridge_chatgpt.py", line 189, in predict if ('data: [DONE]' in chunk_decoded) or (len(json.loads(chunk_decoded[6:])['choices'][0]["delta"]) == 0): File "json__init__.py", line 346, in loads File "json\decoder.py", line 337, in decode File "json\decoder.py", line 355, in raw_decode json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

eddata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": "I"}, "delta": {"content": "I"}}]}f3data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " can"}, "delta": {"content": " can"}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " help"}, "delta": {"content": " help"}}]}f3data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " you"}, "delta": {"content": " you"}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " find"}, "delta": {"content": " find"}}]}103data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " information"}, "delta": {"content": " information"}}]}f1data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " on"}, "delta": {"content": " on"}}]}fbdata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " various"}, "delta": {"content": " various"}}]}f9data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " topics"}, "delta": {"content": " topics"}}]}f1data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " or"}, "delta": {"content": " or"}}]}f9data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " answer"}, "delta": {"content": " answer"}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " your"}, "delta": {"content": " your"}}]}ffdata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " questions"}, "delta": {"content": " questions"}}]}f7data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " about"}, "delta": {"content": " about"}}]}fddata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " specific"}, "delta": {"content": " specific"}}]}fddata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " subjects"}, "delta": {"content": " subjects"}}]}eddata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": "."}, "delta": {"content": "."}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " What"}, "delta": {"content": " What"}}]}f7data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " would"}, "delta": {"content": " would"}}]}f3data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " you"}, "delta": {"content": " you"}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " like"}, "delta": {"content": " like"}}]}f1data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " me"}, "delta": {"content": " me"}}]}f1data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " to"}, "delta": {"content": " to"}}]}f9data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " assist"}, "delta": {"content": " assist"}}]}f3data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " you"}, "delta": {"content": " you"}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " with"}, "delta": {"content": " with"}}]}eddata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": "?"}, "delta": {"content": "?"}}]}13bdata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": "stop", "message": {"content": ""}, "delta": {"content": ""}}], "usage": {"prompt_tokens": 45, "completion_tokens": 78, "total_tokens": 123}}data: [DONE]

看好像起来是流式传输引起的问题

text-gen-ui中日志:

127.0.0.1 - - [04/Jun/2023 14:53:06] "POST /v1/chat/completions HTTP/1.1" 200 - Host: 127.0.0.1:5001 User-Agent: python-requests/2.31.0 Accept-Encoding: gzip, deflate Accept: / Connection: keep-alive Content-Type: application/json Authorization: Bearer sk-123456789012345678901234567890123456789012345678 Content-Length: 201

{'model': 'gpt-4', 'messages': [{'role': 'system', 'content': ''}, {'role': 'user', 'content': ''}], 'temperature': 1, 'top_p': 1, 'n': 1, 'stream': True, 'presence_penalty': 0, 'frequency_penalty': 0} Loaded instruction role format: Vicuna-v0 {'prompt': "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.\n\n\n### Human: \n### Assistant:", 'req_params': {'max_new_tokens': 200, 'temperature': 1.0, 'top_p': 1.0, 'top_k': 1, 'repetition_penalty': 1.18, 'encoder_repetition_penalty': 1.0, 'suffix': None, 'stream': True, 'echo': False, 'seed': -1, 'truncation_length': 2048, 'add_bos_token': True, 'do_sample': True, 'typical_p': 1.0, 'epsilon_cutoff': 0, 'eta_cutoff': 0, 'tfs': 1.0, 'top_a': 0.0, 'min_length': 0, 'no_repeat_ngram_size': 0, 'num_beams': 1, 'penalty_alpha': 0.0, 'length_penalty': 1, 'early_stopping': False, 'mirostat_mode': 0, 'mirostat_tau': 5, 'mirostat_eta': 0.1, 'ban_eos_token': False, 'skip_special_tokens': True, 'custom_stopping_strings': ['\nsystem:', '\nuser:', '\nhuman:', '\nassistant:', '\n###']}, 'stopping_strings': ['\nsystem:', '\nuser:', '\nhuman:', '\nassistant:', '\n###']} Output generated in 3.66 seconds (7.38 tokens/s, 27 tokens, context 45, seed 1749489419) {'answer': 'I can help you find information on various topics or answer your questions about specific subjects. What would you like me to assist you with?'} {'id': 'chatcmpl-1685861586', 'object': 'chat.completions.chunk', 'created': 1685861586, 'model': 'Vicuna-30B-GPTQ-4bit', 'choices': [{'index': 0, 'finish_reason': 'stop', 'message': {'content': ''}, 'delta': {'content': ''}}], 'usage': {'prompt_tokens': 45, 'completion_tokens': 78, 'total_tokens': 123}}

Pb-207 commented 1 year ago

之前写过一部分了https://github.com/binary-husky/gpt_academic/blob/master/request_llm/bridge_tgui.py 不过有一段时间text-generation-webui的api功能不稳定,所以一直搁置到现在 现在Oobabooga/text-generation-webui已有仿OpenAi的API后端,但需要配置变量OPENAI_API_BASE=http://127.0.0.1:5001/v1,应该在已有的代码上稍作修改即可。

尝试修改了bridge_all.py的重定向部分为:

Endpoint 重定向

API_URL_REDIRECT, = get_conf("API_URL_REDIRECT") openai_endpoint = "http://127.0.0.1:5001/v1/chat/completions" api2d_endpoint = "http://127.0.0.1:5001/v1/chat/completions"

现在能正常向text-gen-ui的openai api发送请求并接受响应,但响应的json不能被正确解析,报错: Traceback (most recent call last): File ".\request_llm\bridge_chatgpt.py", line 189, in predict if ('data: [DONE]' in chunk_decoded) or (len(json.loads(chunk_decoded[6:])['choices'][0]["delta"]) == 0): File "jsoninit.py", line 346, in loads File "json\decoder.py", line 337, in decode File "json\decoder.py", line 355, in raw_decode json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

eddata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": "I"}, "delta": {"content": "I"}}]}f3data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " can"}, "delta": {"content": " can"}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " help"}, "delta": {"content": " help"}}]}f3data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " you"}, "delta": {"content": " you"}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " find"}, "delta": {"content": " find"}}]}103data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " information"}, "delta": {"content": " information"}}]}f1data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " on"}, "delta": {"content": " on"}}]}fbdata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " various"}, "delta": {"content": " various"}}]}f9data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " topics"}, "delta": {"content": " topics"}}]}f1data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " or"}, "delta": {"content": " or"}}]}f9data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " answer"}, "delta": {"content": " answer"}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " your"}, "delta": {"content": " your"}}]}ffdata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " questions"}, "delta": {"content": " questions"}}]}f7data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " about"}, "delta": {"content": " about"}}]}fddata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " specific"}, "delta": {"content": " specific"}}]}fddata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " subjects"}, "delta": {"content": " subjects"}}]}eddata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": "."}, "delta": {"content": "."}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " What"}, "delta": {"content": " What"}}]}f7data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " would"}, "delta": {"content": " would"}}]}f3data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " you"}, "delta": {"content": " you"}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " like"}, "delta": {"content": " like"}}]}f1data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " me"}, "delta": {"content": " me"}}]}f1data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " to"}, "delta": {"content": " to"}}]}f9data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " assist"}, "delta": {"content": " assist"}}]}f3data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " you"}, "delta": {"content": " you"}}]}f5data: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": " with"}, "delta": {"content": " with"}}]}eddata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": null, "message": {"content": "?"}, "delta": {"content": "?"}}]}13bdata: {"id": "chatcmpl-1685861586", "object": "chat.completions.chunk", "created": 1685861586, "model": "Vicuna-30B-GPTQ-4bit", "choices": [{"index": 0, "finish_reason": "stop", "message": {"content": ""}, "delta": {"content": ""}}], "usage": {"prompt_tokens": 45, "completion_tokens": 78, "total_tokens": 123}}data: [DONE]

看好像起来是流式传输引起的问题

text-gen-ui中日志:

127.0.0.1 - - [04/Jun/2023 14:53:06] "POST /v1/chat/completions HTTP/1.1" 200 - Host: 127.0.0.1:5001 User-Agent: python-requests/2.31.0 Accept-Encoding: gzip, deflate Accept: / Connection: keep-alive Content-Type: application/json Authorization: Bearer sk-123456789012345678901234567890123456789012345678 Content-Length: 201

{'model': 'gpt-4', 'messages': [{'role': 'system', 'content': ''}, {'role': 'user', 'content': ''}], 'temperature': 1, 'top_p': 1, 'n': 1, 'stream': True, 'presence_penalty': 0, 'frequency_penalty': 0} Loaded instruction role format: Vicuna-v0 {'prompt': "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.\n\n\n### Human: \n### Assistant:", 'req_params': {'max_new_tokens': 200, 'temperature': 1.0, 'top_p': 1.0, 'top_k': 1, 'repetition_penalty': 1.18, 'encoder_repetition_penalty': 1.0, 'suffix': None, 'stream': True, 'echo': False, 'seed': -1, 'truncation_length': 2048, 'add_bos_token': True, 'do_sample': True, 'typical_p': 1.0, 'epsilon_cutoff': 0, 'eta_cutoff': 0, 'tfs': 1.0, 'top_a': 0.0, 'min_length': 0, 'no_repeat_ngram_size': 0, 'num_beams': 1, 'penalty_alpha': 0.0, 'length_penalty': 1, 'early_stopping': False, 'mirostat_mode': 0, 'mirostat_tau': 5, 'mirostat_eta': 0.1, 'ban_eos_token': False, 'skip_special_tokens': True, 'custom_stopping_strings': ['\nsystem:', '\nuser:', '\nhuman:', '\nassistant:', '\n###']}, 'stopping_strings': ['\nsystem:', '\nuser:', '\nhuman:', '\nassistant:', '\n###']} Output generated in 3.66 seconds (7.38 tokens/s, 27 tokens, context 45, seed 1749489419) {'answer': 'I can help you find information on various topics or answer your questions about specific subjects. What would you like me to assist you with?'} {'id': 'chatcmpl-1685861586', 'object': 'chat.completions.chunk', 'created': 1685861586, 'model': 'Vicuna-30B-GPTQ-4bit', 'choices': [{'index': 0, 'finish_reason': 'stop', 'message': {'content': ''}, 'delta': {'content': ''}}], 'usage': {'prompt_tokens': 45, 'completion_tokens': 78, 'total_tokens': 123}}

该报错是因为text-gen-ui openai 插件的一个BUG, 现已修复,可正常对接API了。

pengtb commented 11 months ago

2023-12-10的text-generation-ui api目前还是有些问题:

Traceback (most recent call last): File "./request_llms/bridge_chatgpt.py", line 242, in predict if ('data: [DONE]' in chunk_decoded) or (len(chunkjson['choices'][0]["delta"]) == 0):


TypeError: 'NoneType' object is not subscriptable

不知道为什么有时候突然chunkjson变为None了
amdsice commented 10 months ago

期待解决 这个问题,并详细说下使用方法!!!