Skip to content

Commit

Permalink
fix model training output for epoch frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
ain-soph committed Jun 13, 2023
1 parent 4ae4c46 commit 518f432
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions trojanzoo/utils/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def train(module: nn.Module, num_classes: int,
cur_acc = validate_result[0]
if cur_acc >= best_acc:
best_validate_result = validate_result
if verbose:
if verbose and output_freq == 'iter':
prints('{purple}best result update!{reset}'.format(
**ansi), indent=indent)
prints(f'Current Acc: {cur_acc:.3f} '
Expand All @@ -212,7 +212,7 @@ def train(module: nn.Module, num_classes: int,
if save:
save_fn(_epoch=_epoch, file_path=file_path, folder_path=folder_path,
suffix=suffix, verbose=verbose)
if verbose:
if verbose and output_freq == 'iter':
prints('-' * 50, indent=indent)
module.zero_grad()
return best_validate_result
Expand Down

0 comments on commit 518f432

Please sign in to comment.