Skip to content

[BUG/Help] API部署 #688

Open
Open
@Yxj-study

Description

@Yxj-study

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions