Skip to content

Commit

Permalink
fixes assertion for data loaders
Browse files Browse the repository at this point in the history
Assertion in train.py fixed to check the train, validation and test data loaders according to be in train or evaluate mode
  • Loading branch information
ermanok committed Jul 23, 2023
1 parent d2bec85 commit 48c94d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ def main():
args.workers, args.validation_split, args.deterministic,
args.effective_train_size, args.effective_valid_size, args.effective_test_size,
test_only=args.evaluate, collate_fn=args.collate_fn, cpu=args.device == 'cpu')
assert train_loader is not None and val_loader is not None
assert args.evaluate or train_loader is not None and val_loader is not None, \
"No training and/or validation data in train mode"
assert not args.evaluate or test_loader is not None, "No test data in eval mode"

if args.sensitivity is not None:
sensitivities = np.arange(args.sensitivity_range[0], args.sensitivity_range[1],
Expand Down

0 comments on commit 48c94d6

Please sign in to comment.