Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update utils.py - Fixed save_checkpoint with scheduler set to None #8

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

peacefulotter
Copy link

The save_checkpoint raised an error if scheduler was set to None. This is fixed by setting the scheduler state_dict to None in case the scheduler is not set.

@@ -40,7 +40,8 @@ def train_base(model, opt, data, scheduler, iterations, acc_steps, batch_size, s
if extra_args.grad_clip != 0.0:
torch.nn.utils.clip_grad_norm_(model.parameters(), extra_args.grad_clip)
opt.step()
scheduler.step()
if scheduler != None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if scheduler is not None

(otherwise LGTM)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello, this kind of fix was already proposed in the soap branch,
but we didn't change the sparse.py

thanks for the reminder)

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

Successfully merging this pull request may close these issues.

3 participants