vllm安装踩坑

今天是2024/7/18.

vllm0.5.2最近一周出了个不好搞的新issue,会遇到torch.ops._C没有rms_norm,或者没有reshape_and_cache_flash这两个属性的问题。

完整报错如下:
AttributeError: ‘_OpNamespace’ ‘_C_cache_ops’ object has no attribute ‘reshape_and_cache_flash’
AttributeError: ‘_OpNamespace’ ‘_C’ object has no attribute ‘rms_norm’

rms_norm issue链接
reshape_and_cache_flash issue链接

————————————————————

我没找到好的解决办法,issue里说的情况都是在用源码安装后遇到的,我直接在干净环境ubuntu20.24 cuda12.2下面pip安装,仍然遇到了问题。而且问题指向是torch里的class缺少属性,因此我猜测是torch的问题,vllm的每个版本又强制要求某个torch版本,因此我只能选择之前的vllm版本。

出错的安装环境:
torch2.3.1, vllm0.5.2

我回退了几个版本,用了pip install vllm0.4.0,它默认使用torch2.1.2,然后就不报错了。(如果不知道vllm有哪些版本,可以这样:pip install vllm3516356 随便打个数字,pip会报错说没有这个版本,然后告诉你可选择的所有版本)

下面是vllm官网quickstart里的例子,可用于测试vllm是否工作。

from vllm import LLM, SamplingParams
prompts = [
    "Hello, my name is",
    "The president of the United States is",
    "The capital of France is",
    "The future of AI is",
]
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)

llm = LLM(model="facebook/opt-125m")

outputs = llm.generate(prompts, sampling_params)

# Print the outputs.
for output in outputs:
    prompt = output.prompt
    generated_text = output.outputs[0].text
    print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
~                                                                                                                                                                                         
~                                                                            

——————————————————————
其他的错误

有些人虽然正常运行了,但是能看见warning: 没有flash attention。
你安装pip install flash-attn,运气不好又遇到这个:
ImportError: cannot import name ‘packaging’ from ‘pkg_resources’
原因是setuptools太新了,回退到pip install setuptools==69.5.1 --no-cache-dir就可以了。

相关推荐

  1. vllm安装

    2024-07-19 19:38:05       23 阅读
  2. FollowYourPose 安装

    2024-07-19 19:38:05       43 阅读
  3. node-nass安装

    2024-07-19 19:38:05       33 阅读
  4. 】Ubuntu20.4安装Vivado

    2024-07-19 19:38:05       66 阅读
  5. go 语言 mage 安装

    2024-07-19 19:38:05       36 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-19 19:38:05       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-19 19:38:05       71 阅读
  3. 在Django里面运行非项目文件

    2024-07-19 19:38:05       58 阅读
  4. Python语言-面向对象

    2024-07-19 19:38:05       69 阅读

热门阅读

  1. 探索Eureka的高级用法:在服务中实现分布式锁

    2024-07-19 19:38:05       18 阅读
  2. ArkTS语法---运算符及语句

    2024-07-19 19:38:05       22 阅读
  3. Python_封装和继承

    2024-07-19 19:38:05       15 阅读
  4. SQL Server 和 MySQL 的主要区别

    2024-07-19 19:38:05       20 阅读
  5. 益铭祥元宇宙

    2024-07-19 19:38:05       19 阅读
  6. 计算机视觉7 kag比赛

    2024-07-19 19:38:05       19 阅读
  7. 《管理表格系统》开发心得

    2024-07-19 19:38:05       20 阅读
  8. gdb 的常用指令

    2024-07-19 19:38:05       19 阅读
  9. 矩形加矩形求和

    2024-07-19 19:38:05       20 阅读
  10. TCP协议

    TCP协议

    2024-07-19 19:38:05      19 阅读
  11. 深入探讨:Node.js、Vue、SSH服务与SSH免密登录

    2024-07-19 19:38:05       21 阅读
  12. GitHub每日最火火火项目(7.18)

    2024-07-19 19:38:05       18 阅读
  13. 微服务常用的中间件有哪些?都有什么用途?

    2024-07-19 19:38:05       18 阅读