[BUG/Help] API部署
Author: Yxj-studyCreated Mar 20, 2025Updated Mar 20, 2025
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
api部署的时候发生错误
Expected Behavior
No response
Steps To Reproduce
- git clone https://github.com/THUDM/ChatGLM2-6B cd ChatGLM2-6B
2.pip install -r requirements.txt
3.streamlit run web_demo2.py 这个可以正常运行
4.执行python openai_api.py 后我创建了一个python文件,内容是 mport openai if name == "main": openai.api_base = "http://localhost:8000/v1" openai.api_key = "none" for chunk in openai.ChatCompletion.create( model="chatglm2-6b", messages=[ {"role": "user", "content": "你好"} ], stream=True ): if hasattr(chunk.choices[0].delta, "content"): print(chunk.choices[0].delta.content, end="", flush=True)
运行这个文件出现报错
Environment
- OS:Windows
- Python:3.11
- Transformers:
- PyTorch:
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :Anything else?
No response
Source: zai-org/ChatGLM2-6B