          self.side = sorted(sides)[0]
          self.loss = {side: [0] for side in sides}
          logger.debug("Initialized %s", self.__class__.__name__)
  
      def switch(self):
          """ Switch ping-pong training from one side of the model to the other """
          if not self.active:
              return
 
</s> remove         """ Switch pingpong side """
 </s> add         """ Switch ping-pong training from one side of the model to the other """ </s> remove         self.active = model.training_opts.get("pingpong", False)
        self.model = model
        self.sides = sides
 </s> add         self._model = model
        self._sides = sides </s> remove         retval = [side for side in self.sides if side != self.side][0]
 </s> add         retval = [side for side in self._sides if side != self.side][0] </s> remove     def reload_model(self):
        """ Load the model for just the current side """
 </s> add     def _reload_model(self):
        """ Clear out the model from VRAM and reload for the next side to be trained with ping-pong
        training """ </s> remove         self.reload_model()
 </s> add         self._reload_model()
    @property
    def active(self):
        """ bool: ``True`` if Ping Pong training is active otherwise ``False``. """
        return self._model.training_opts.get("pingpong", False)

          self.side = sorted(sides)[0]
          self.loss = {side: [0] for side in sides}
          logger.debug("Initialized %s", self.__class__.__name__)
  
    @property
    def active(self):
        """ bool: ``True`` if Ping Pong training is active otherwise ``False``. """
        return self._model.training_opts.get("pingpong", False)

      def switch(self):
          """ Switch ping-pong training from one side of the model to the other """
          if not self.active:
              return
keep keep keep add 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