A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 17, 06:45 UTC
Fix loading error when safetensors contains empty tensor (#1687)
twaka committed
Nov 17, 2023 at 03:38 UTC
2a2c135b41e8894a8feb1a2b8a434bb23d3eb623
1 file changed
+6
-1
vllm/model_executor/weight_utils.py
+6
-1
@@ -258,7 +258,12 @@ def convert_pyslice_to_tensor(x: Any) -> torch.Tensor:
258
tensor first.
259
"""
260
if not isinstance(x, torch.Tensor):
261
- x = x[:]
261
+ try:
262
+ x = x[:]
263
+ except IndexError:
264
+ # IndexError happens when the tensor is empty.
265
+ # transformer.h.0.attn.masked_bias is empty in some gpt2 models.
266
+ return torch.Tensor()
267
return x
268
269