Skip to content

Commit acbf471

Browse files
committed
Merge branch 'main' of https://github.com/moverseai/moai
2 parents d081ecd + c528592 commit acbf471

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

moai/core/model.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,12 @@ def closure(tensors, index, steps, stage, optimizer, objective):
401401
C._FREQUENCY_, 1
402402
) # default to each batch end
403403
assigners = []
404-
if batch_idx == 0: # get initializers only in the first batch
405-
for i, o in assign_params.items():
406-
if (
407-
i == C._FREQUENCY_
408-
): # NOTE: refactor this, keys should be not coupled like this
409-
continue
410-
assigners.append((i, _create_assigner(o)))
404+
for i, o in assign_params.items():
405+
if (
406+
i == C._FREQUENCY_
407+
): # NOTE: refactor this, keys should be not coupled like this
408+
continue
409+
assigners.append((i, _create_assigner(o)))
411410
with torch.no_grad(): # use torch no grad as most params are leaf tensors and assign is an inplace operation
412411
if frequency == 0: # if frequency is 0 call only once
413412
if batch_idx == 0:

0 commit comments

Comments
 (0)