-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
GLM-4-9B-chat FastApi 部署调用报错“Method not allowed” #293
Comments
试一下这种方式呢 import requests
import json
def get_completion(prompt):
headers = {'Content-Type': 'application/json'}
data = {"prompt": prompt, "history": []}
response = requests.post(url='http://127.0.0.1:6006', headers=headers, data=json.dumps(data))
return response.json()['response']
if __name__ == '__main__':
print(get_completion('你好,讲个幽默小故事')) |
这是下面的api-request.py函数吧,我也试了,也会报错: During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): 我看了别人的issue,有些人提到可以更新transformer,我更新到最新的,仍然有问题 |
运行api.py之后 这个代码是要持续运行的,就是api.py是要持续运行着的 |
抱歉刚才忘记运行api.py了,运行完之后,我再运行了api-request.py,报错以下内容: During handling of the above exception, another exception occurred: Traceback (most recent call last): |
api.py是要持续运行的不可以关闭的 这是一个服务,然后再另一个终端运行你的请求代码 |
我是这样做的呀,api.py的终端一直运行者,在新终端运行了python api-request |
新终端运行api-request.py时,api.py的终端报一下信息: |
ChatGLMForConditionalGeneration 模型对象没有 chat 方法 解决方法参考: |
按照这个issue修改之后,api-request.py是可以正确运行的。但是在api.py之后,直接输入crul那三行,会输出这些内容,不知道是触发了什么机制。这样的话就只能调用api-requset.py了吗? root@autodl-container-c543418832-b3b1dfa7: |
这输出的内容有什么问题吗? |
应该是没有设置 stop_token,或者是那个惩罚系数。要不你看一个最新的教程叭,Qwen2.5-coder的,哈哈哈 |
老师指定让学习glm的哈哈,总结我遇到的问题,应该就是Transformer, accelerate两个包有更新,原来的环境配置需要更新;另外更新包后还需要改变chat方式,参考issue#249。总之谢谢你们~ |
好的,欢迎提交PR哦~ |
创建并运行完api.py后,在新的终端里输入
curl -X POST "http://127.0.0.1:6006"
-H 'Content-Type: application/json'
-d '{"prompt": "你好", "history": []}'
不能够正确返回,终端报错“Internal Server Errorroot@autodl-container-c543418832-b3b1dfa7:~/autodl-tmp# ”
浏览器中查看6006端口,发现提示Method not allowed。
The text was updated successfully, but these errors were encountered: