              if do_timelapse:
                  self.timelapse.output_timelapse()
  
              if do_snapshot:
                  self.model.do_snapshot()
          except Exception as err:
              raise err
  
      def store_history(self, side, loss):
          """ Store the history of this step """
 
</s> remove     def store_history(self, side, loss):
        """ Store the history of this step """
 </s> add     def _store_history(self, side, loss):
        """ Store the loss for this step into :attr:`model.history`.

        Parameters
        ----------
        side: {"a", "b"}
            The side to store the loss for
        loss: list
            The list of loss ``floats`` for this side
        """ </s> remove                 self.timelapse.output_timelapse()
 </s> add                 self._timelapse.output_timelapse() </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 </s> remove     def load_model(self):
        """ Load the model requested for training """
 </s> add     def _load_model(self):
        """ Load the model requested for training.

        Returns
        -------
        :file:`plugins.train.model` plugin
            The requested model plugin
        """ </s> remove                 with self.lock:
                    self.preview_buffer[name] = image
 </s> add                 with self._lock:
                    self._preview_buffer[name] = image
                self._model.do_snapshot()
              if do_timelapse:
                  self.timelapse.output_timelapse()
  
              if do_snapshot:
                self._model.do_snapshot()
          except Exception as err:
              raise err
  
      def store_history(self, side, loss):
          """ Store the history of this step """
keep keep keep keep 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