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

glm4 AttributeError: 'ChatGLMForConditionalGeneration' object has no attribute 'chat' #245

Open
lydd2024 opened this issue Aug 25, 2024 · 2 comments

Comments

@lydd2024
Copy link

按照 01-GLM-4-9B-chat FastApi 部署调用.md 调用报错
INFO: 127.0.0.1:13068 - "POST / HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "D:\anaconda3\envs\glm4\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 408, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\glm4\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\glm4\Lib\site-packages\fastapi\applications.py", line 1106, in call
await super().call(scope, receive, send)
File "D:\anaconda3\envs\glm4\Lib\site-packages\starlette\applications.py", line 122, in call
await self.middleware_stack(scope, receive, send)
File "D:\anaconda3\envs\glm4\Lib\site-packages\starlette\middleware\errors.py", line 184, in call
raise exc
File "D:\anaconda3\envs\glm4\Lib\site-packages\starlette\middleware\errors.py", line 162, in call
await self.app(scope, receive, _send)
File "D:\anaconda3\envs\glm4\Lib\site-packages\starlette\middleware\exceptions.py", line 79, in call
raise exc
File "D:\anaconda3\envs\glm4\Lib\site-packages\starlette\middleware\exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "D:\anaconda3\envs\glm4\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 20, in call
raise e
File "D:\anaconda3\envs\glm4\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 17, in call
await self.app(scope, receive, send)
File "D:\anaconda3\envs\glm4\Lib\site-packages\starlette\routing.py", line 718, in call
await route.handle(scope, receive, send)
File "D:\anaconda3\envs\glm4\Lib\site-packages\starlette\routing.py", line 276, in handle
await self.app(scope, receive, send)
File "D:\anaconda3\envs\glm4\Lib\site-packages\starlette\routing.py", line 66, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\glm4\Lib\site-packages\fastapi\routing.py", line 274, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\anaconda3\envs\glm4\Lib\site-packages\fastapi\routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\project\glm4-api\api.py", line 36, in create_item
response, history = model.chat(
^^^^^^^^^^
File "D:\anaconda3\envs\glm4\Lib\site-packages\torch\nn\modules\module.py", line 1729, in getattr
raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'")
AttributeError: 'ChatGLMForConditionalGeneration' object has no attribute 'chat'
和教程的区别是模型从魔搭上下载的

@hongmin118
Copy link

我之前按教程搭的,也报这个错,执行pip install --upgrade transformers就可以了。
今天在autodl下新租了台机器,结果执行仍然抛错,懵逼了。。。

@aivike
Copy link

aivike commented Sep 12, 2024

我也碰到了,有解决思路吗?

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

3 participants