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

LLM的url具体是什么呢,以Qwen为例可以举一个例子吗 #6

Closed
promisecc opened this issue Dec 14, 2023 · 13 comments
Closed
Labels
good first issue Good for newcomers

Comments

@promisecc
Copy link

No description provided.

@Ki-Seki
Copy link
Member

Ki-Seki commented Dec 14, 2023

因为我们做大规模的测试,需要多个人同时访问大模型,所以就把模型部署到共有的服务器上,封装成API了,这样可以方便多个人使用,remote.py 里的模型都是这样。所以如果你要用Qwen的话,可能需要

  1. 拥有一个有公网IP和高性能GPU服务器;
  2. 在服务器上部署好Qwen大模型;
  3. 使用API部署工具对大模型的调用进行封装,我们用的是 FastAPI 进行 API 封装。

如果不想使用上面的办法,也可以尝试:

  • 看看 Qwen 官方是否提供 API,直接使用官方 API。
  • 部署 Qwen 到本机,直接在本机进行模型推理。

@zhiyulee-RUC
Copy link
Contributor

大概两周左右,我们会再增加一个模块,支持从本地GPU自动部署和调起评估框架,感谢您的关注!

In about two weeks, we will add another module that supports automatic deployment and invocation of the evaluation framework from a local GPU. Appreciate your interest!

@promisecc
Copy link
Author

因为我们做大规模的测试,需要多个人同时访问大模型,所以就把模型部署到共有的服务器上,封装成API了,这样可以方便多个人使用,remote.py 里的模型都是这样。所以如果你要用Qwen的话,可能需要

  1. 拥有一个有公网IP和高性能GPU服务器;
  2. 在服务器上部署好Qwen大模型;
  3. 使用API部署工具对大模型的调用进行封装,我们用的是 FastAPI 进行 API 封装。

如果不想使用上面的办法,也可以尝试:

  • 看看 Qwen 官方是否提供 API,直接使用官方 API。
  • 部署 Qwen 到本机,直接在本机进行模型推理。

好的,非常感谢您的解答

zhiyulee-RUC pushed a commit that referenced this issue Jan 14, 2024
feat: added TruthfulQA dataset and corresponding evaluator
@Bryce-Peng
Copy link
Contributor

大概两周左右,我们会再增加一个模块,支持从本地GPU自动部署和调起评估框架,感谢您的关注!

In about two weeks, we will add another module that supports automatic deployment and invocation of the evaluation framework from a local GPU. Appreciate your interest!

请问目前这项工作的还在正常进行吗

@Ki-Seki
Copy link
Member

Ki-Seki commented Jan 15, 2024

是的还在正常进行的哈,目前主分支已经支持从本地加载大模型啦。参见uhgeval/llm/local.py文件

@Ki-Seki
Copy link
Member

Ki-Seki commented Jan 15, 2024

这里再正式回复下,大模型里的 url 可以通过使用 vLLM 的方式实现,具体步骤如下:

  1. 从 HuggingFace 下载你需要的模型到本地,比如 Qwen/Qwen-7B-Chat
  2. 使用 vLLM 的 entrypoints 部署模型为一个服务,参考 vLLM 的教程,Quickstart
CUDA_VISIBLE_DEVICES=0,1,2,3 python -m vllm.entrypoints.api_server \
	--model /this/is/an/example/path/to/Qwen/Qwen-7B-Chat \
        --host 0.0.0.0 \
        --port 8000 \
        --tensor-parallel-size 4
  1. 此时通过 http://localhost:8000/generate 就可以访问 Qwen/Qwen-7B-Chat,bash 和 python 脚本访问的方式如下
curl http://localhost:8000/generate \
    -d '{
        "prompt": "San Francisco is a",
        "use_beam_search": true,
        "n": 4,
        "temperature": 0
    }'
url = http://localhost:8000/generate
payload = json.dumps({
    "prompt": 'hello world',
    "temperature": 0.1,
    "max_tokens": 16,
    "n": 1
})
headers = {
    'Content-Type': 'application/json'
}
res = requests.request("POST", url, headers=headers, data=payload)
res = res.json()['text'][0].replace(query, '')  # VLLM will automatically append the query to the response, so here we remove it.
return res

使用 vLLM 的好处是可以实现请求的批处理,评测速度快。当然目前 uhgeval/llm/local.py 也实现了从 HuggingFace 的 transformer 库直接加载模型的方法,以供参考。

@Ki-Seki Ki-Seki added the good first issue Good for newcomers label Jan 15, 2024
@Ki-Seki Ki-Seki pinned this issue Jan 15, 2024
@Ki-Seki Ki-Seki closed this as completed Jan 15, 2024
@zjj100-zjj
Copy link

请问可以直接下载大模型到本地,添加本地路径吗?

@Ki-Seki
Copy link
Member

Ki-Seki commented Jan 26, 2024

请问可以直接下载大模型到本地,添加本地路径吗?

可以的哈,目前已经支持通过huggingface的trasformers库加载大模型了,参考这个文件:./uhgeval/llm/local.py

@zjj100-zjj
Copy link

zjj100-zjj commented Jan 26, 2024 via email

@zjj100-zjj
Copy link

请问metric可以从huggingface下载到本地吗?我没代理,不能访问huggingface

@Ki-Seki
Copy link
Member

Ki-Seki commented Jan 26, 2024

好的,谢谢您!我可以只添加我的本地模型,不改变其他的,就把路径改成我本地模型路径就可以了,是吧?

------------------ 原始邮件 ------------------ 发件人: "Shichao @.>; 发送时间: 2024年1月26日(星期五) 下午5:47 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [IAAR-Shanghai/UHGEval] LLM的url具体是什么呢,以Qwen为例可以举一个例子吗 (Issue #6) 请问可以直接下载大模型到本地,添加本地路径吗? 可以的哈,目前已经支持通过huggingface的trasformers库加载大模型了,参考这个文件:./uhgeval/llm/local.py — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

对,是的

@Ki-Seki
Copy link
Member

Ki-Seki commented Jan 26, 2024

请问metric可以从huggingface下载到本地吗?我没代理,不能访问huggingface

对的,你可以参考下这里的处理办法 https://github.com/IAAR-Shanghai/UHGEval/tree/main/uhgeval/.cache/huggingface。这里实现的rouge和bleu就是下载到本地的方法。

@IAAR-Shanghai IAAR-Shanghai locked as too heated and limited conversation to collaborators Jan 26, 2024
@Ki-Seki
Copy link
Member

Ki-Seki commented Jan 26, 2024

建议大家不要在这个 issue 下提问题啦。如果有新的问题建议新开一个 issue 哈。这样我们可以保证单个 issue 的独立性。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants