Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/moverseai/moai
Browse files Browse the repository at this point in the history
  • Loading branch information
nmvrs committed Jan 17, 2025
2 parents d081ecd + c528592 commit acbf471
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions moai/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,12 @@ def closure(tensors, index, steps, stage, optimizer, objective):
C._FREQUENCY_, 1
) # default to each batch end
assigners = []
if batch_idx == 0: # get initializers only in the first batch
for i, o in assign_params.items():
if (
i == C._FREQUENCY_
): # NOTE: refactor this, keys should be not coupled like this
continue
assigners.append((i, _create_assigner(o)))
for i, o in assign_params.items():
if (
i == C._FREQUENCY_
): # NOTE: refactor this, keys should be not coupled like this
continue
assigners.append((i, _create_assigner(o)))
with torch.no_grad(): # use torch no grad as most params are leaf tensors and assign is an inplace operation
if frequency == 0: # if frequency is 0 call only once
if batch_idx == 0:
Expand Down

0 comments on commit acbf471

Please sign in to comment.