Skip to content

[Misc]: OOM (CUDA Out Of Memory) when running LLMs in WSL using vLLM #7655

Description

@WizMatrix

Environment:

  • WSL version: 2.2.4.0
  • Kernel version: 5.15.153.1-2
  • WSLg version: 1.0.61
  • MSRDC version: 1.2.5326
  • Direct3D version: 1.611.1-81528511
  • DXCore version: 10.0.26091.1-240325-1447.ge-release
  • Windows version: 10.0.22631.2861
  • RTX3050, 4GBs VRAM, 40 GBs RAM
  • CUDA Version: 12.1

vLLM version: 0.5.4

Problem:

When running Qwen2 in WSL using vLLM, I encounter a CUDA Out Of Memory (OOM) error.

Commands and errors:

  • cmd1:
vllm serve Qwen/Qwen2-7B-Instruct-GPTQ-Int4 --gpu-memory-utilization 0.99 --quantization "gptq"
File "/home/ubuntu/.local/lib/python3.10/site-packages/torch/utils/_device.py", line 79, in __torch_function__
    return func(*args, **kwargs)
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 34.00 MiB. GPU 0 has a total capacity of 4.00 GiB of which 0 bytes is free. Including non-PyTorch memory, this process has 17179869184.00 GiB memory in use. Of the allocated memory 3.35 GiB is allocated by PyTorch, and 125.23 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation.  See documentation for Memory Management  (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

I suspected that my 4GB VRAM RTX 3050 was not sufficient to run Qwen2, so I tried to offload to the CPU by using cmd2:

  • cmd2:
vllm serve Qwen/Qwen2-7B-Instruct-GPTQ-Int4 --cpu_offload_gb 10 --quantization "gptq"
File "/home/ubuntu/.local/lib/python3.10/site-packages/torch/utils/_device.py", line 79, in __torch_function__
    return func(*args, **kwargs)
NotImplementedError: Cannot copy out of meta tensor; no data!

Additional context:

This issue is not limited to Qwen2, as I also encounter a similar OOM error when running neuralmagic/Meta-Llama-3-8B-Instruct-quantized.w4a16.

I would appreciate any help in resolving this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions