core.BaseTrainer — spacr 0.5.0 documentation

# core.BaseTrainer

## Module Contents

class core.BaseTrainer.BaseTrainer(model, dataloaders, optimizer, scheduler=None, criterion=None, num_epochs=100, device='cuda:0', no_valid=False, valid_frequency=1, amp=False, algo_params=None)

  Abstract base class for trainer implementations

  model
  dataloaders
  optimizer
  scheduler = None
  criterion = None
  num_epochs = 100
  no_valid = False
  valid_frequency = 1
  device = 'cuda:0'
  amp = False
  best_weights = None
  best_f1_score = 0.1
  scaler = None
  loss_metric
  f1_metric
  post_pred
  post_gt
  train()

    Train the model