当前环境
The output of `python collect_env.py`
PyTorch version: 2.2.1+cpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
Clang version: Could not collect
CMake version: version 3.29.0
Libc version: glibc-2.35
Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-97-generic-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 52 bits physical, 57 bits virtual
Byte Order: Little Endian
CPU(s): 240
On-line CPU(s) list: 0-239
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Platinum 8490H
CPU family: 6
Model: 143
Socket(s): 2
Stepping: 8
CPU max MHz: 3500.0000
CPU min MHz: 800.0000
BogoMIPS: 3800.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
Virtualization: VT-x
L1d cache: 5.6 MiB (120 instances)
L1i cache: 3.8 MiB (120 instances)
L2 cache: 240 MiB (120 instances)
L3 cache: 225 MiB (2 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0-59,120-179
NUMA node1 CPU(s): 60-119,180-239
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] torch==2.2.1+cpu
[pip3] triton==2.3.0
[conda] Could not collectROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.4.0.post1
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
Could not collect
🐛 描述bug
参考这个文档,我构建了一个docker镜像:
docker build -f Dockerfile.cpu -t vllm-cpu-env --shm-size=4g .
然后运行容器:
docker run -it \
--rm \
--network=host \
vllm-cpu-env
接着尝试加载Mixtral 8x7b并进行推理,但是得到了AssertionError: Torch not compiled with CUDA enabled
。
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",
]
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
model_path="/models/Mixtral-8x7B-Instruct-v0.1"
llm = LLM(model=model_path,device="cpu",trust_remote_code=True)
outputs = llm.generate(prompts, sampling_params)
for output in outputs:
prompt = output.prompt
generated_text = output.outputs[0].text
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
WARNING 04-09 14:13:01 ray_utils.py:70] Failed to import Ray with ModuleNotFoundError("No module named 'ray'"). For distributed inference, please install Ray with `pip install ray`.
INFO 04-09 14:13:01 llm_engine.py:81] Initializing an LLM engine (v0.4.0.post1) with config: model='/models/Mixtral-8x7B-Instruct-v0.1.safetensors', speculative_config=None, tokenizer='/models/Mixtral-8x7B-Instruct-v0.1.safetensors', tokenizer_mode=auto, revision=None, tokenizer_revision=None, trust_remote_code=True, dtype=torch.bfloat16, max_seq_len=32768, download_dir=None, load_format=auto, tensor_parallel_size=1, disable_custom_all_reduce=True, quantization=None, enforce_eager=False, kv_cache_dtype=auto, quantization_param_path=None, device_config=cpu, seed=0)
WARNING 04-09 14:13:01 cpu_executor.py:126] CUDA graph is not supported on CPU, fallback to the eager mode.
WARNING 04-09 14:13:01 cpu_executor.py:145] Environment variable VLLM_CPU_KVCACHE_SPACE (GB) for CPU backend is not set, using 4 by default.
INFO 04-09 14:13:01 pynccl_utils.py:17] Failed to import NCCL library: NCCL only supports CUDA and ROCm backends.
INFO 04-09 14:13:01 pynccl_utils.py:18] It is expected if you are not running on NVIDIA GPUs.
WARNING 04-09 14:13:01 utils.py:359] Pin memory is not supported on CPU.
INFO 04-09 14:13:01 selector.py:21] Using Torch SDPA backend.
Traceback (most recent call last):
File "/workspace/vllm/examples/offline_inference.py", line 18, in <module>
llm = LLM(model=mix2,device="cpu",trust_remote_code=True)
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/entrypoints/llm.py", line 112, in __init__
self.llm_engine = LLMEngine.from_engine_args(
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/engine/llm_engine.py", line 209, in from_engine_args
engine = cls(
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/engine/llm_engine.py", line 119, in __init__
self.model_executor = executor_class(
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/executor/cpu_executor.py", line 37, in __init__
self._init_worker()
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/executor/cpu_executor.py", line 61, in _init_worker
self.driver_worker.load_model()
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/worker/cpu_worker.py", line 168, in load_model
self.model_runner.load_model()
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/worker/cpu_worker.py", line 27, in load_model
self.model = get_model(self.model_config,
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/model_executor/model_loader.py", line 81, in get_model
model = model_class(model_config.hf_config, linear_method,
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/model_executor/models/mixtral.py", line 353, in __init__
self.model = MixtralModel(config,
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/model_executor/models/mixtral.py", line 298, in __init__
self.layers = nn.ModuleList([
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/model_executor/models/mixtral.py", line 299, in <listcomp>
MixtralDecoderLayer(config, linear_method=linear_method)
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/model_executor/models/mixtral.py", line 239, in __init__
self.block_sparse_moe = MixtralMoE(
File "/usr/local/lib/python3.10/dist-packages/vllm-0.4.0.post1+cpu-py3.10-linux-x86_64.egg/vllm/model_executor/models/mixtral.py", line 90, in __init__
torch.empty(self.num_total_experts,
File "/usr/local/lib/python3.10/dist-packages/torch/utils/_device.py", line 77, in __torch_function__
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/cuda/__init__.py", line 293, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
7条答案
按热度按时间vltsax251#
你好,@chzhyang,感谢你报告这个问题。目前CPU后端还不支持MoE模型。
f0ofjuux2#
你好,@chzhyang,感谢你报告这个问题。CPU后端目前还不支持MoE模型。
感谢你的快速回复。如果我们有一个矩阵显示模型、硬件、量化等信息,它会更加用户友好。
pxiryf3j3#
感谢反馈!是的,我们正在准备。目前,CPU后端仅支持BF16和FP32数据类型。FP16和量化支持正在进行中。
roejwanj4#
你好,@chzhyang。感谢你的反馈。CPU后端目前已支持并仍在开发中。你可以通过#3654跟踪状态和最近的计划。
qacovj5a5#
你好,@chzhyang。感谢你的反馈。CPU后端目前已支持并仍在开发中。你可以通过#3654跟踪状态和最近的计划。
感谢你提供CPU执行模式。
我尝试在Docker中构建一个CPU运行时环境。当我执行
python3 -m vllm.entrypoints.openai.api_server --port 38000 --model /root/.cache/modelscope/hub/qwen/Qwen1.5-14B-Chat --served-model-name Qwen1.5-7B-Chat --max-model-len 4096
时,遇到了一个错误。CPU数据集:
我正在使用Qwen的模型,我相信它是BF16数据类型。BF16数据类型是否还不支持在CPU上运行?
tyg4sfes6#
你好,@papandadj,感谢你的反馈。默认情况下,CPU上的在线推理功能是禁用的,因为它需要更多的调整。我认为你可以期待#3993被合并。
ruoxqz4g7#
CPU后端仅支持BF16和FP32,是否有关于FP16和量化支持的更新?