          do_preview = viewer is not None
          do_timelapse = timelapse_kwargs is not None
          snapshot_interval = self.model.training_opts.get("snapshot_interval", 0)
          do_snapshot = (snapshot_interval != 0 and
                         self.model.iterations >= snapshot_interval and
                         self.model.iterations % snapshot_interval == 0)
  
          loss = dict()
          try:
              for side, batcher in self.batchers.items():
                  if self.pingpong.active and side != self.pingpong.side:
 
</s> remove         snapshot_interval = self.model.training_opts.get("snapshot_interval", 0)
 </s> add         snapshot_interval = self._model.training_opts.get("snapshot_interval", 0) </s> remove             for side, batcher in self.batchers.items():
                if self.pingpong.active and side != self.pingpong.side:
 </s> add             for side, batcher in self._batchers.items():
                if self._pingpong.active and side != self._pingpong.side: </s> remove         """ Train a batch """
        logger.trace("Training one step: (iteration: %s)", self.model.iterations)
 </s> add         """ Running training on a batch of images for each side.

        Triggered from the training cycle in :class:`scripts.train.Train`.

        Notes
        -----
        As every iteration is called explicitly, the Parameters defined should always be ``None``
        except on save iterations.

        Parameters
        ----------
        viewer: :func:`scripts.train.Train._show`
            The function that will display the preview image
        timelapse_kwargs: dict
            The keyword arguments for generating time-lapse previews. If a time-lapse preview is
            not required then this should be ``None``. Otherwise all values should be full paths
            the keys being `input_a`, `input_b`, `output`.
        """
        logger.trace("Training one step: (iteration: %s)", self._model.iterations) </s> remove                 loss[side] = batcher.train_one_batch(do_preview)
 </s> add                 loss[side] = batcher.train_one_batch() </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
                       self._model.iterations >= snapshot_interval and
                       self._model.iterations % snapshot_interval == 0)
          do_preview = viewer is not None
          do_timelapse = timelapse_kwargs is not None
          snapshot_interval = self.model.training_opts.get("snapshot_interval", 0)
          do_snapshot = (snapshot_interval != 0 and
                       self._model.iterations >= snapshot_interval and
                       self._model.iterations % snapshot_interval == 0)
                       self._model.iterations >= snapshot_interval and
                       self._model.iterations % snapshot_interval == 0)
  
          loss = dict()
          try:
              for side, batcher in self.batchers.items():
                  if self.pingpong.active and side != self.pingpong.side:
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. 
plugins/train/trainer/_base.py