Skip to content

Commit 152cc6d

Browse files
author
Tharmeekan
committed
Fix load_model to transfer full_tensor
1 parent 987929e commit 152cc6d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/weathergen/model/model_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def load_model(cf, model, device, run_id: str, mini_epoch=-1):
204204
)
205205
maybe_sharded_sd[param_name] = torch.nn.Parameter(sharded_tensor)
206206
else:
207-
maybe_sharded_sd[param_name] = full_tensor
207+
maybe_sharded_sd[param_name] = full_tensor.to(device)
208208
# choose `assign=True` for sharded model since we cannot call `copy_` on meta tensor
209209
mkeys, ukeys = model.load_state_dict(maybe_sharded_sd, strict=False, assign=True)
210210

0 commit comments

Comments
 (0)