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

[BUG/Help] API部署 #688

Open
1 task done
Yxj-study opened this issue Mar 20, 2025 · 0 comments
Open
1 task done

[BUG/Help] API部署 #688

Yxj-study opened this issue Mar 20, 2025 · 0 comments

Comments

@Yxj-study
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

api部署的时候发生错误

Image

Expected Behavior

No response

Steps To Reproduce

  1. 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

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

1 participant