                            self.args.configfile)
          logger.debug("Loaded Trainer")
          return trainer
  
      def run_training_cycle(self, model, trainer):
          """ Perform the training cycle """
          logger.debug("Running Training Cycle")
          if self.args.write_image or self.args.redirect_gui or self.args.preview:
              display_func = self.show
          else:
              display_func = None
 
</s> remove         if self.args.write_image or self.args.redirect_gui or self.args.preview:
            display_func = self.show
 </s> add         if self._args.write_image or self._args.redirect_gui or self._args.preview:
            display_func = self._show </s> remove                           self.images,
                          self.args.batch_size,
                          self.args.configfile)
 </s> add                           self._images,
                          self._args.batch_size,
                          self._args.configfile) </s> remove         for iteration in range(0, self.args.iterations):
 </s> add         for iteration in range(0, self._args.iterations): </s> remove             save_iteration = iteration % self.args.save_interval == 0
            viewer = display_func if save_iteration or self.save_now else None
            timelapse = self.timelapse if save_iteration else None
 </s> add             save_iteration = iteration % self._args.save_interval == 0
            viewer = display_func if save_iteration or self._save_now else None
            timelapse = self._timelapse if save_iteration else None </s> remove             if self.stop:
 </s> add             if self._stop:
    def _run_training_cycle(self, model, trainer):
        """ Perform the training cycle.

        Handles the background training, updating previews/time-lapse on each save interval,
        and saving the model.

        Parameters
        ----------
        model: :file:`plugins.train.model` plugin
            The requested model plugin
        trainer: :file:`plugins.train.trainer` plugin
            The requested model trainer plugin
        """
                            self.args.configfile)
          logger.debug("Loaded Trainer")
          return trainer
  
    def _run_training_cycle(self, model, trainer):
        """ Perform the training cycle.

        Handles the background training, updating previews/time-lapse on each save interval,
        and saving the model.

        Parameters
        ----------
        model: :file:`plugins.train.model` plugin
            The requested model plugin
        trainer: :file:`plugins.train.trainer` plugin
            The requested model trainer plugin
        """
    def _run_training_cycle(self, model, trainer):
        """ Perform the training cycle.

        Handles the background training, updating previews/time-lapse on each save interval,
        and saving the model.

        Parameters
        ----------
        model: :file:`plugins.train.model` plugin
            The requested model plugin
        trainer: :file:`plugins.train.trainer` plugin
            The requested model trainer plugin
        """
          logger.debug("Running Training Cycle")
          if self.args.write_image or self.args.redirect_gui or self.args.preview:
              display_func = self.show
          else:
              display_func = None
keep keep keep keep replace replace keep keep keep keep keep
 Smart Masks - Training Implementation (#914)

* Smart Masks - Training

- Reinstate smart mask training code
- Reinstate mask_type back to model.config
- change 'replicate_input_mask to 'learn_mask'
- Add learn mask option
- Add mask loading from alignments to plugins.train.trainer
- Add mask_blur and mask threshold options
- _base.py - Pass mask options through training_opts dict
- plugins.train.model - check for mask_type not None for learn_mask and penalized_mask_loss
- Limit alignments loading to just those faces that appear in the training folder
- Raise error if not all training images have an alignment, and alignment file is required
- lib.training_data - Mask generation code
- lib.faces_detect - cv2 dimension stripping bugfix
- Remove cv2 linting code

* Update mask helptext in cli.py

* Fix Warp to Landmarks
Remove SHA1 hashing from training data

* Update mask training config

* Capture missing masks at training init

* lib.image.read_image_batch - Return filenames with batch for ordering

* scripts.train - Documentation

* plugins.train.trainer - documentation

* Ensure backward compatibility.
Fix convert for new predicted masks

* Update removed masks to components for legacy models. 
scripts/train.py