          model = PluginLoader.get_model(trainer)(model_dir, gpus, predict=True)
          logger.debug("Loaded Model")
          return model
  
      def get_trainer(self, model_dir):
          """ Return the trainer name if provided, or read from state file """
          if hasattr(self.args, "trainer") and self.args.trainer:
              logger.debug("Trainer name provided: '%s'", self.args.trainer)
              return self.args.trainer
  
          statefile = [fname for fname in os.listdir(str(model_dir))
                       if fname.endswith("_state.json")]
          if len(statefile) != 1:
              raise FaceswapError("There should be 1 state file in your model folder. {} were "
 
</s> remove             raise FaceswapError("{} does not exist.".format(self.args.model_dir))
        trainer = self.get_trainer(model_dir)
        gpus = 1 if not hasattr(self.args, "gpus") else self.args.gpus
 </s> add             raise FaceswapError("{} does not exist.".format(self._args.model_dir))
        trainer = self._get_model_name(model_dir)
        gpus = 1 if not hasattr(self._args, "gpus") else self._args.gpus </s> remove         model_dir = get_folder(self.args.model_dir, make_folder=False)
 </s> add         model_dir = get_folder(self._args.model_dir, make_folder=False) </s> remove         state = self.serializer.load(statefile)
 </s> add         state = self._serializer.load(statefile) </s> remove     def predict_faces(self):
        """ Get detected faces from images """
 </s> add     def _launch_predictor(self):
        """ Launch the prediction process in a background thread.

        Starts the prediction thread and returns the thread.

        Returns
        -------
        :class:`~lib.multithreading.MultiThread`
            The started Faceswap model prediction thread.
        """
        thread = MultiThread(self._predict_faces, thread_count=1)
        thread.start()
        return thread

    def _predict_faces(self):
        """ Run Prediction on the Faceswap model in a background thread.

        Reads from the :attr:`self._in_queue`, prepares images for prediction
        then puts the predictions back to the :attr:`self.out_queue`
        """ </s> remove     def load_model(self):
        """ Load the model requested for conversion """
 </s> add     def _load_model(self):
        """ Load the Faceswap model.

        Returns
        -------
        :mod:`plugins.train.model` plugin
            The trained model in the specified model folder
        """
    def _get_model_name(self, model_dir):
        """ Return the name of the Faceswap model used.

        If a "trainer" option has been selected in the command line arguments, use that value,
        otherwise retrieve the name of the model from the model's state file.

        Parameters
        ----------
        model_dir: str
            The folder that contains the trained Faceswap model

        Returns
        -------
        str
            The name of the Faceswap model being used.

        """
        if hasattr(self._args, "trainer") and self._args.trainer:
            logger.debug("Trainer name provided: '%s'", self._args.trainer)
            return self._args.trainer
          model = PluginLoader.get_model(trainer)(model_dir, gpus, predict=True)
          logger.debug("Loaded Model")
          return model
  
    def _get_model_name(self, model_dir):
        """ Return the name of the Faceswap model used.

        If a "trainer" option has been selected in the command line arguments, use that value,
        otherwise retrieve the name of the model from the model's state file.

        Parameters
        ----------
        model_dir: str
            The folder that contains the trained Faceswap model

        Returns
        -------
        str
            The name of the Faceswap model being used.

        """
        if hasattr(self._args, "trainer") and self._args.trainer:
            logger.debug("Trainer name provided: '%s'", self._args.trainer)
            return self._args.trainer
    def _get_model_name(self, model_dir):
        """ Return the name of the Faceswap model used.

        If a "trainer" option has been selected in the command line arguments, use that value,
        otherwise retrieve the name of the model from the model's state file.

        Parameters
        ----------
        model_dir: str
            The folder that contains the trained Faceswap model

        Returns
        -------
        str
            The name of the Faceswap model being used.

        """
        if hasattr(self._args, "trainer") and self._args.trainer:
            logger.debug("Trainer name provided: '%s'", self._args.trainer)
            return self._args.trainer
    def _get_model_name(self, model_dir):
        """ Return the name of the Faceswap model used.

        If a "trainer" option has been selected in the command line arguments, use that value,
        otherwise retrieve the name of the model from the model's state file.

        Parameters
        ----------
        model_dir: str
            The folder that contains the trained Faceswap model

        Returns
        -------
        str
            The name of the Faceswap model being used.

        """
        if hasattr(self._args, "trainer") and self._args.trainer:
            logger.debug("Trainer name provided: '%s'", self._args.trainer)
            return self._args.trainer
    def _get_model_name(self, model_dir):
        """ Return the name of the Faceswap model used.

        If a "trainer" option has been selected in the command line arguments, use that value,
        otherwise retrieve the name of the model from the model's state file.

        Parameters
        ----------
        model_dir: str
            The folder that contains the trained Faceswap model

        Returns
        -------
        str
            The name of the Faceswap model being used.

        """
        if hasattr(self._args, "trainer") and self._args.trainer:
            logger.debug("Trainer name provided: '%s'", self._args.trainer)
            return self._args.trainer
    def _get_model_name(self, model_dir):
        """ Return the name of the Faceswap model used.

        If a "trainer" option has been selected in the command line arguments, use that value,
        otherwise retrieve the name of the model from the model's state file.

        Parameters
        ----------
        model_dir: str
            The folder that contains the trained Faceswap model

        Returns
        -------
        str
            The name of the Faceswap model being used.

        """
        if hasattr(self._args, "trainer") and self._args.trainer:
            logger.debug("Trainer name provided: '%s'", self._args.trainer)
            return self._args.trainer
  
          statefile = [fname for fname in os.listdir(str(model_dir))
                       if fname.endswith("_state.json")]
          if len(statefile) != 1:
              raise FaceswapError("There should be 1 state file in your model folder. {} were "
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
 Smart Masks to Convert (#957)

- scripts.convert - Use Smart Masks for Convert
    * Make on-the-fly conversion an explicit option

- Move BlurMask to lib.faces_detect

- tools.preview - Fix for smart masks
    * Subclass from tk.Tk
    * Options to lib.gui.control_helper
    *variable cleanup

- lib.logger - Demote more tensorflow deprecation messages

- Documentation:
    * lib.faces_detect.BlurMask
    * plugins.convert.mask
    * lib.convert
    * scripts.convert
    * scripts.fsmedia
    * tools.preview 
scripts/convert.py