Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
norm
vllm
Commits
2a2c135b
Unverified
Commit
2a2c135b
authored
Nov 17, 2023
by
twaka
Committed by
GitHub
Nov 16, 2023
Browse files
Fix loading error when safetensors contains empty tensor (#1687)
parent
65ea2ddf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
vllm/model_executor/weight_utils.py
vllm/model_executor/weight_utils.py
+6
-1
No files found.
vllm/model_executor/weight_utils.py
View file @
2a2c135b
...
...
@@ -258,7 +258,12 @@ def convert_pyslice_to_tensor(x: Any) -> torch.Tensor:
tensor first.
"""
if
not
isinstance
(
x
,
torch
.
Tensor
):
try
:
x
=
x
[:]
except
IndexError
:
# IndexError happens when the tensor is empty.
# transformer.h.0.attn.masked_bias is empty in some gpt2 models.
return
torch
.
Tensor
()
return
x
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment