  
      def snapshot_models(self, iterations):
          """ Take a snapshot of the model at current state and back up """
          logger.info("Saving snapshot")
          dst = str(get_folder("{}_snapshot_{}_iters".format(self.model_dir, iterations)))
          for filename in os.listdir(self.model_dir):
              if not self.check_valid(filename, for_restore=False):
                  logger.debug("Not snapshotting file: '%s'", filename)
                  continue
              srcfile = os.path.join(self.model_dir, filename)
 
</s> remove         logger.debug("Initialized session")
 </s> add         logger.debug("Initialized session. Session_ID: %s", self.session_id) </s> remove         root = get_config().root
 </s> add  </s> remove         logger.trace("Loading aligned face: (size: %s, align_eyes: %s, dtype: %s)",
                     size, align_eyes, dtype)
        padding = int(size * self.extract_ratio) // 2
        self.aligned["size"] = size
        self.aligned["padding"] = padding
        self.aligned["align_eyes"] = align_eyes
        self.aligned["matrix"] = get_align_mat(self, size, align_eyes)
        if image is None:
            self.aligned["face"] = None
 </s> add         # Don't reload an already aligned face:
        if self.aligned:
            logger.trace("Skipping alignment calculation for already aligned face")
        snapshot_dir = "{}_snapshot_{}_iters".format(self.model_dir, iterations)

        if os.path.isdir(snapshot_dir):
            logger.debug("Removing previously existing snapshot folder: '%s'", snapshot_dir)
            rmtree(snapshot_dir)

        dst = str(get_folder(snapshot_dir))
  
      def snapshot_models(self, iterations):
          """ Take a snapshot of the model at current state and back up """
          logger.info("Saving snapshot")
        snapshot_dir = "{}_snapshot_{}_iters".format(self.model_dir, iterations)

        if os.path.isdir(snapshot_dir):
            logger.debug("Removing previously existing snapshot folder: '%s'", snapshot_dir)
            rmtree(snapshot_dir)

        dst = str(get_folder(snapshot_dir))
          for filename in os.listdir(self.model_dir):
              if not self.check_valid(filename, for_restore=False):
                  logger.debug("Not snapshotting file: '%s'", filename)
                  continue
              srcfile = os.path.join(self.model_dir, filename)
keep keep keep keep replace keep keep keep keep keep
 Bugfixes

- Fix filter/nfilter for convert
- Remove existing snapshot folder before creating if it pre-exists
- Don't initialize training session until after first save. "Nonetype" session fix 
lib/model/backup_restore.py