          self._model.compile(optimizer=optimizer, loss=self._loss.functions)
          self._state.add_session_loss_names(self._loss.names)
          logger.debug("Compiled Model: %s", self._model)
  
      def _freeze_weights(self):
          """ If freeze has been selected in the cli arguments, then freeze those models indicated
          in the plugin's configuration. """
          if not self._args.freeze_weights:
              logger.debug("Freeze weights deselected. Not freezing")
              return
  
          to_freeze = self.config.get("freeze_layers")  # Standardized config for freezing weights
          to_freeze = to_freeze if to_freeze else ["encoder"]  # No plugin config
          for layer in self._get_all_sub_models(self._model):
              if layer.name in to_freeze:
                  logger.info("Freezing weights for '%s' in model '%s'", layer.name, self.name)
                  layer.trainable = False
                  to_freeze.remove(layer.name)
          if to_freeze:
              logger.warning("The following layers were set to be frozen but do not exist in the "
                             "model: %s", to_freeze)
  
      def _rewrite_plaid_outputs(self):
          """ Rewrite the output names for models using the PlaidML (Keras 2.2.4) backend
  
          Keras 2.2.4 duplicates model output names if any of the models have multiple outputs
          so we need to rename the outputs so we can successfully map the loss dictionaries.
 
</s> remove     def _get_all_sub_models(self, model, models=None):
        """ For a given model, return all sub-models that occur (recursively) as children.

        Parameters
        ----------
        model: :class:`keras.models.Model`
            A Keras model to scan for sub models
        models: `None`
            Do not provide this parameter. It is used for recursion

        Returns
        -------
        list
            A list of all :class:`keras.models.Model`s found within the given model. The provided
            model will always be returned in the first position
        """
        if models is None:
            models = [model]
        else:
            models.append(model)
        for layer in model.layers:
            if isinstance(layer, KModel):
                self._get_all_sub_models(layer, models=models)
        return models

 </s> add  </s> remove         self._freeze_weights()
 </s> add         weights = _Weights(self)
        weights.load(self._io.model_exists)
        weights.freeze()
 </s> remove         for model in self._get_all_sub_models(self._model):
 </s> add         for model in _get_all_sub_models(self._model): </s> remove #: lib/cli/args.py:949
 </s> add #: lib/cli/args.py:965 </s> remove #: lib/cli/args.py:959
 </s> add #: lib/cli/args.py:975
          self._model.compile(optimizer=optimizer, loss=self._loss.functions)
          self._state.add_session_loss_names(self._loss.names)
          logger.debug("Compiled Model: %s", self._model)
  


















      def _rewrite_plaid_outputs(self):
          """ Rewrite the output names for models using the PlaidML (Keras 2.2.4) backend
  
          Keras 2.2.4 duplicates model output names if any of the models have multiple outputs
          so we need to rename the outputs so we can successfully map the loss dictionaries.
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Training - Load Weights
  - Enable the loading of previously trained encoders for new models. 
plugins/train/model/_base.py