Skip to content

docker运行报错:multiproc_worker_utils.py:226] RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method #305

Description

@syusama

提交前必须检查以下项目 | The following items must be checked before submission

  • 请确保使用的是仓库最新代码(git pull),一些问题已被解决和修复。 | Make sure you are using the latest code from the repository (git pull), some issues have already been addressed and fixed.
  • 我已阅读项目文档和FAQ章节并且已在Issue中对问题进行了搜索,没有找到相似问题和解决方案 | I have searched the existing issues / discussions

问题类型 | Type of problem

模型推理和部署 | Model inference and deployment

操作系统 | Operating system

Linux

详细描述问题 | Detailed description of the problem

Ubuntu上docker-compose部署Qwen2-7B-Instruct报错

(VllmWorkerProcess pid=294) ERROR 08-14 16:36:35 multiproc_worker_utils.py:226]   File "/usr/local/lib/python3.10/dist-packages/vllm/worker/worker.py", line 123, in init_device
(VllmWorkerProcess pid=294) ERROR 08-14 16:36:35 multiproc_worker_utils.py:226]     torch.cuda.set_device(self.device)
(VllmWorkerProcess pid=294) ERROR 08-14 16:36:35 multiproc_worker_utils.py:226]   File "/usr/local/lib/python3.10/dist-packages/torch/cuda/__init__.py", line 420, in set_device
(VllmWorkerProcess pid=294) ERROR 08-14 16:36:35 multiproc_worker_utils.py:226]     torch._C._cuda_setDevice(device)
(VllmWorkerProcess pid=294) ERROR 08-14 16:36:35 multiproc_worker_utils.py:226]   File "/usr/local/lib/python3.10/dist-packages/torch/cuda/__init__.py", line 300, in _lazy_init
(VllmWorkerProcess pid=294) ERROR 08-14 16:36:35 multiproc_worker_utils.py:226]     raise RuntimeError(
(VllmWorkerProcess pid=294) ERROR 08-14 16:36:35 multiproc_worker_utils.py:226] RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method
(VllmWorkerProcess pid=294) ERROR 08-14 16:36:35 multiproc_worker_utils.py:226] 

其中关键信息是
RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method

Dependencies

# 请在此处粘贴依赖情况
# Please paste the dependencies here

运行日志或截图 | Runtime logs or screenshots

# 请在此处粘贴运行日志
# Please paste the run log here

微信截图_20240815003843

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions