                      break
                  pbar.update(len(buffer))
                  out_file.write(buffer)
  
      def unzip_model(self):
          """ Unzip the model file to the cachedir """
          self.logger.info("Extracting: '%s'", self._model_name)
 
</s> remove             if self.args.write_image:
 </s> add             if self._args.write_image: </s> remove def get_config(plugin_name, configfile=None):
    """ Return the config for the requested model """
 </s> add def _get_config(plugin_name, configfile=None):
    """ Return the configuration for the requested trainer.

    Parameters
    ----------
    plugin_name: str
        The name of the plugin to load the configuration for
    configfile: str, optional
        A custom configuration file. If ``None`` then configuration is loaded from the default
        :file:`.config.train.ini` file. Default: ``None``

    Returns
    -------
    :class:`lib.config.FaceswapConfig`
        The configuration file for the requested plugin
    """ </s> remove     def process_training_opts(self):
        """ Override for processing model specific training options """
        logger.debug(self.model.training_opts)
        if self.landmarks_required:
            landmarks = Landmarks(self.model.training_opts).landmarks
            self.model.training_opts["landmarks"] = landmarks
 </s> add     def _process_training_opts(self):
        """ Extrapolate alignments and masks from the alignments file into
        :attr:`_model.training_opts`."""
        logger.debug(self._model.training_opts)
        if not self._landmarks_required and not self._use_mask:
            return </s> remove         self.model.history[side].append(loss[0])  # Either only loss or total loss
 </s> add         self._model.history[side].append(loss[0])  # Either only loss or total loss
            pbar.close()
                      break
                  pbar.update(len(buffer))
                  out_file.write(buffer)
            pbar.close()
  
      def unzip_model(self):
          """ Unzip the model file to the cachedir """
          self.logger.info("Extracting: '%s'", self._model_name)
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. 
lib/utils.py