2
模型应用
提问帖
有回复
新人贴
vllm 0.9.2 运行离线推理脚本报错
2026-01-17 22:28:04
106
使用来自官方的docker pull harbor.sourcefind.cn:5443/dcu/admin/base/pytorch:2.5.1-ubuntu22.04-dtk25.04.4-1230-py3.10-20260115 pytorch镜像,里面提供了0.9.2的vllm,运行vllm官方的离线推理脚本报错 内容如下 ```python # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm import LLM, SamplingParams # Sample prompts. prompts = [ "Hello, my name is", "The president of the United States is", "The capital of France is", "The future of AI is", ] # Create a sampling params object. sampling_params = SamplingParams(temperature=0.8, top_p=0.95) def main(): # Create an LLM. llm = LLM(model="facebook/opt-125m") # Generate texts from the prompts. # The output is a list of RequestOutput objects # that contain the prompt, generated text, and other information. outputs = llm.generate(prompts, sampling_params) # Print the outputs. print("\nGenerated Outputs:\n" + "-" * 60) for output in outputs: prompt = output.prompt generated_text = output.outputs[0].text print(f"Prompt: {prompt!r}") print(f"Output: {generated_text!r}") print("-" * 60) if __name__ == "__main__": main() ``` 终端运行的报错如下,跟换别的模型也是一样 ```basg cqu_cs_201@1985116dcc8d:~/project/vllm-demo$ python basic.py INFO 01-17 22:18:10 [__init__.py:245] Automatically detected platform rocm. Traceback (most recent call last): File "/public/home/cqu_cs_201/project/vllm-demo/basic.py", line 4, in from vllm import LLM, SamplingParams File "/usr/local/lib/python3.10/dist-packages/vllm/__init__.py", line 64, in __getattr__ module = import_module(module_name, __package__) File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/llm.py", line 20, in from vllm.config import (CompilationConfig, ModelDType, TokenizerMode, File "/usr/local/lib/python3.10/dist-packages/vllm/config.py", line 38, in from vllm.transformers_utils.config import ( File "/usr/local/lib/python3.10/dist-packages/vllm/transformers_utils/config.py", line 33, in from vllm.transformers_utils.configs import (ChatGLMConfig, Cohere2Config, File "/usr/local/lib/python3.10/dist-packages/vllm/transformers_utils/configs/__init__.py", line 20, in from vllm.transformers_utils.configs.mllama import MllamaConfig File "/usr/local/lib/python3.10/dist-packages/vllm/transformers_utils/configs/mllama.py", line 4, in from transformers.models.mllama import configuration_mllama as mllama_hf_config ModuleNotFoundError: No module named 'transformers.models.mllama' ```
全部评论(1)
只看楼主
D
dp1
1楼
你好,按照提供的镜像和脚本无法复现,我尝试可以使用vllm起模型,步骤如下:

docker pull harbor.sourcefind.cn:5443/dcu/admin/base/pytorch:2.5.1-ubuntu22.04-dtk25.04.4-1230-py3.10-20260115

docker run -dit \
  --shm-size=128G \
  --network=host \
  --name=qwen3_test \
  --privileged \
  --device=/dev/kfd \
  --device=/dev/dri \
  --group-add video \
  --cap-add=SYS_PTRACE \
  --security-opt seccomp=unconfined \
  -v /opt/hyhal/:/opt/hyhal/:ro \
  -v /public/home/xxx/qwen3_vllm:/workspace/qwen3_vllm \
  -u root \
  111ed476aeea /bin/bash

vllm serve /workspace/qwen3_vllm/model/Qwen3-4B-Thinking-2507/ \
        --host 0.0.0.0 \
        --port 8116 \
        --dtype float16 --tensor-parallel-size 1 \
        --trust-remote-code \
        --max-num-seqs 512

curl http://localhost:8116/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "/workspace/qwen3_vllm/model/Qwen3-4B-Thinking-2507/",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "介绍下北京"}
    ],
    "max_tokens": 10
  }'


1/18
没有更多内容了
--
楼主
Level.1
0 帖子
楼主热帖
暂无数据