Skip to content

Commit 955b991

Browse files
committed
Meta -> cpu for uninitialized weights
1 parent 12d4073 commit 955b991

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

examples/models/llama/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ def __init__(self, **kwargs):
251251
"Could not load checkpoint into mode, defaulting to random uninitialized weights."
252252
)
253253
print(f"Error: {e}")
254+
# Need to provide concrete (empty) values for meta-initialized tensors for quantization.
255+
self.model_.to_empty(device="cpu")
254256

255257
if missing:
256258
missing_weights = [fqn for fqn in missing if fqn.endswith(".weight")]

0 commit comments

Comments
 (0)