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

[CodeCamp2023-472] Add parameter save_begin #1271

Merged
merged 16 commits into from
Jul 25, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
try to fix unit test failed
  • Loading branch information
KerwinKai committed Jul 25, 2023
commit dc8b1adf7f7e4431ebe4ae89a1923a6830997cce
4 changes: 2 additions & 2 deletions mmengine/hooks/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def every_n_epochs(self, runner, n: int, start: int = 0) -> bool:
Returns:
bool: Whether current epoch can be evenly divided by n.
"""
dividend = runner.epoch + 1 - start
dividend = int(runner.epoch + 1 - start)
return dividend % n == 0 if dividend >= 0 and n > 0 else False

def every_n_inner_iters(self, batch_idx: int, n: int) -> bool:
Expand Down Expand Up @@ -380,7 +380,7 @@ def every_n_train_iters(self, runner, n: int, start: int = 0) -> bool:
bool: Return True if the current iteration can be evenly divided
by n, otherwise False.
"""
dividend = runner.iter + 1 - start
dividend = int(runner.iter + 1 - start)
return dividend % n == 0 if dividend >= 0 and n > 0 else False

def end_of_epoch(self, dataloader, batch_idx: int) -> bool:
Expand Down