Skip to content

Commit

Permalink
simplify weight copying logic
Browse files Browse the repository at this point in the history
  • Loading branch information
scottcha committed Sep 19, 2024
1 parent 8924e8e commit 70c5d2c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions aurora/model/aurora.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,9 @@ def adapt_checkpoint_max_history_size(self, checkpoint) -> Any:
device=weight.device, dtype=weight.dtype)

# Copy the existing weights to the new tensor by duplicating the histories provided into any new history dimensions
for j in range(new_weight.shape[2]):
if j < weight.shape[2]:
# only fill existing weights, others are zeros
new_weight[:, :, j, :, :] = weight[:, :, j, :, :]
for j in range(weight.shape[2]):
# only fill existing weights, others are zeros
new_weight[:, :, j, :, :] = weight[:, :, j, :, :]
checkpoint[name] = new_weight
return checkpoint

Expand Down

0 comments on commit 70c5d2c

Please sign in to comment.