          if not self.models_exist and self.predict:
              logger.error("Model could not be found in folder '%s'. Exiting", self.model_dir)
              exit(0)
  
          if not self.is_legacy or not self.predict:
              K.clear_session()
          model_mapping = self.map_models(swapped)
          for network in self.networks.values():
              if not network.side:
                  is_loaded = network.load()
 
</s> remove                 loss[side] = batcher.train_one_batch()
 </s> add                 loss[side] = batcher.train_one_batch(do_preview) </s> remove                     batcher.generate_preview(do_preview)
 </s> add  </s> remove         masks = masks if masks is not None else self.masks
        samples = samples if samples is not None else self.samples
        retval = [samples[0:num_images], images[0:num_images], masks[0:num_images]]
 </s> add         retval = [samples[0:num_images]] if samples is not None else [self.samples[0:num_images]]
        if self.use_mask:
            retval.extend(tgt[0:num_images] for tgt in images)
        else:
            retval.extend(images[0:num_images]) </s> remove         if self._training_opts["warp_to_landmarks"]:
 </s> add         if self._mask_class or to_landmarks: </s> remove         return _JSONSerializer()
    if extension == ".p":
        return _PickleSerializer()
    if extension in (".yaml", ".yml") and yaml is not None:
        return _YAMLSerializer()
    if extension in (".yaml", ".yml") and yaml is None:
 </s> add         retval = _JSONSerializer()
    elif extension == ".p":
        retval = _PickleSerializer()
    elif extension == ".npy":
        retval = _NPYSerializer()
    elif extension == ".fsc":
        retval = _CompressedSerializer()
    elif extension in (".yaml", ".yml") and yaml is not None:
        retval = _YAMLSerializer()
    elif extension in (".yaml", ".yml") and yaml is None:
        if not self.is_legacy:
          if not self.models_exist and self.predict:
              logger.error("Model could not be found in folder '%s'. Exiting", self.model_dir)
              exit(0)
  
        if not self.is_legacy:
              K.clear_session()
          model_mapping = self.map_models(swapped)
          for network in self.networks.values():
              if not network.side:
                  is_loaded = network.load()
keep keep keep keep replace keep keep keep keep keep
 Serialize masks to alignments file

- Add new serializers (npy + compressed)
- Remove Serializer option from cli
- Revert get_aligned call in scripts/extract
- Default alignments to compressed
- Size masks to 128px and compress
- Remove mask thresholding/blur from generation code
- Add Mask class to lib/faces_detect
- Revert debug landmarks to aligned face
- Revert non-extraction code to staging version 
plugins/train/model/_base.py