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

使用 gpu 推理时输出的是!,使用 cpu 推理则正常 #9

Open
luhui opened this issue Sep 25, 2024 · 7 comments
Open

使用 gpu 推理时输出的是!,使用 cpu 推理则正常 #9

luhui opened this issue Sep 25, 2024 · 7 comments

Comments

@luhui
Copy link

luhui commented Sep 25, 2024

硬件型号

11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz 2.42 GHz,集成显卡 Iris

问题现象

使用 gpu 推理结果如下

image

使用 cpu 推理结果正常

image

转化指令

optimum-cli export openvino --model './local_dir' --task text-generation-with-past --weight-format int4 --group-size 128 --ratio 0.8  Qwen2.5-7B-Instruct-int4-ov

推理代码

import openvino_genai as ov_genai
pipe = ov_genai.LLMPipeline("Qwen2.5-7B-Instruct-int4-ov", "GPU")

def streamer(subword):
    print(subword, end='', flush=True)
    return False

pipe.start_chat()
while True:
    try:
        prompt = input('question:\n')
    except EOFError:
        break
    pipe.generate(prompt, eos_token_id=151645, max_length=500, streamer=streamer)
    print('\n----------')
pipe.finish_chat()
@openvino-dev-samples
Copy link
Owner

hi @luhui 你试过用chat.py吗,目前chat_genai.py在集显上是有些问题。

@luhui
Copy link
Author

luhui commented Sep 25, 2024

@openvino-dev-samples hi,我用 chat.py 测试,在 cpu 上能够正常运行,但是使用 gpu 提示。
并且在 compile 阶段,GPU 比 CPU慢了很多,GPU 大概要等半分钟,CPU 不到 10s 就编译完了。

使用 GPU 推理的报错信息

image

使用CPU推理则正常

image

这是因为集显的兼容性问题么?

@openvino-dev-samples
Copy link
Owner

@luhui 感谢分享,GPU编译时间比CPU久是正常的,集显上的这个问题我们还在解决中。

@luhui
Copy link
Author

luhui commented Sep 25, 2024

@openvino-dev-samples 我重新下载模型重试,成功了,用的 genai。

但是模型转化没有使用 export.py,而是用的 optimum-cli,export.py 报如下的错误,好像是前面 save model 后没有释放文件句柄。

image

@luhui
Copy link
Author

luhui commented Sep 25, 2024

另外我目前测试了 qwen2.5 系列的 3B、7B,发现 cpu 输出 token 的性能比 gpu 好 3 倍左右。
现在 openvino 是没有针对集显做优化是吗?

模型转化命令如下:

optimum-cli export openvino --model '.\model\qwen\Qwen2__5-3B-Instruct' --task text-generation-with-past --weight-format int4 --group-size 128 --ratio 0.8  Qwen2.5-3B-Instruct-int4-ov

@openvino-dev-samples
Copy link
Owner

@luhui 感谢分享,看来是因为量化参数问题,我已经在convert.py上做了修改

@openvino-dev-samples
Copy link
Owner

另外我目前测试了 qwen2.5 系列的 3B、7B,发现 cpu 输出 token 的性能比 gpu 好 3 倍左右。 现在 openvino 是没有针对集显做优化是吗?

模型转化命令如下:

optimum-cli export openvino --model '.\model\qwen\Qwen2__5-3B-Instruct' --task text-generation-with-past --weight-format int4 --group-size 128 --ratio 0.8  Qwen2.5-3B-Instruct-int4-ov

目前的优化策略主要围绕Ultra CPU的集显,Iris的集显性能是会差一些

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

2 participants