Skip to content

Instantly share code, notes, and snippets.

@edwardeasling
Created March 29, 2019 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwardeasling/eb7848aa113523c25a0cc9631d4741e7 to your computer and use it in GitHub Desktop.
Save edwardeasling/eb7848aa113523c25a0cc9631d4741e7 to your computer and use it in GitHub Desktop.
BP1 - 02
class BatchCounter(Callback):
def begin_epoch(self, epoch):
self.epoch=epoch
self.batch_counter = 1
return True
def after_step(self):
self.batch_counter += 1
if self.batch_counter % 200 == 0: print(f'Batch {self.batch_counter} completed')
return True
class TimeCheck(Callback):
def begin_fit(self, learn):
self.learn = learn
self.epoch_counter = 1
return True
def begin_epoch(self, epoch):
self.epoch=epoch
print(f'Epoch {self.epoch_counter} started at {time.strftime("%H:%M:%S", time.gmtime())}')
self.epoch_counter += 1
return True
class PrintLoss(Callback):
def after_epoch(self):
print(f'Loss: {self.loss}')
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment