使用来自官方的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'
```
docker pull harbor.sourcefind.cn:5443/dcu/admin/base/pytorch:2.5.1-ubuntu22.04-dtk25.04.4-1230-py3.10-20260115
vllm serve /workspace/qwen3_vllm/model/Qwen3-4B-Thinking-2507/ \