Beispiel #1
0
 def exe(self, mainloop):
     """
     Pickle the mainloop
     """
     if np.mod(mainloop.trainlog._batch_seen, self.freq) == 0:
         pklpath = mainloop.name + '.pkl'
         path = os.path.join(self.path, pklpath)
         logger.info("\tSaving model to: %s" % path)
         try:
             secure_pickle_dump(mainloop, path)
         except Exception:
             raise
Beispiel #2
0
 def exe(self, mainloop):
     """
     Pickle the mainloop
     """
     if len(mainloop.trainlog._ddmonitors) > 0:
         if np.mod(mainloop.trainlog._batch_seen, self.freq) == 0:
             if mainloop.trainlog._ddmonitors[-1][0] < self.best:
                 self.best = mainloop.trainlog._ddmonitors[-1][0]
                 pklpath = mainloop.name + '_best.pkl'
                 path = os.path.join(self.path, pklpath)
                 logger.info("\tSaving best model to: %s" % path)
                 try:
                     secure_pickle_dump(mainloop, path)
                 except Exception:
                     raise