Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

During training, why is optimizer step called after 32 iterations? #120

Open
karthikpullalarevu opened this issue Oct 19, 2022 · 0 comments

Comments

@karthikpullalarevu
Copy link

Referring to this part of code:

if cur_global_batch_size >= cfg.GLOBAL_BATCH_SIZE: # Perform the backward pass. optimizer.zero_grad() loss.backward() # Update the parameters. optimizer.step() else: if cur_iter == 0: optimizer.zero_grad() loss.backward() if (cur_iter + 1) % num_iters == 0: for p in model.parameters(): p.grad /= num_iters optimizer.step() optimizer.zero_grad()

Is it due to batchsize being too small?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant