          sorted_similarity transforms a distance matrix into a sorted distance matrix according to
          the order implied by the hierarchical tree (dendrogram)
          """
          logger.info("Sorting face distances. Depending on your dataset this may take some time...")
          num_predictions = predictions.shape[0]
          result_linkage = linkage(predictions, method=method, preserve_input=False)
          result_order = self.seriation(result_linkage,
                                        num_predictions,
                                        num_predictions + num_predictions - 2)
  
          return result_order
 
</s> remove     def get_model(self, git_model_id, model_filename, backend):
 </s> add     @staticmethod
    def get_model(git_model_id, model_filename, backend): </s> remove from fastcluster import linkage
from lib.utils import GetModel, set_system_verbosity
 </s> add from fastcluster import linkage, linkage_vector
from lib.utils import GetModel, set_system_verbosity, FaceswapError
        num_predictions, dims = predictions.shape

        clustering_method = self._get_clustering_method(num_predictions, dims)

        kwargs = dict(method=method)
        if clustering_method == "linkage":
            kwargs["preserve_input"] = False
            func = linkage
        else:
            func = linkage_vector

        result_linkage = func(predictions, **kwargs)
        print(result_linkage.shape)
        exit(0)
          sorted_similarity transforms a distance matrix into a sorted distance matrix according to
          the order implied by the hierarchical tree (dendrogram)
          """
          logger.info("Sorting face distances. Depending on your dataset this may take some time...")
        num_predictions, dims = predictions.shape

        clustering_method = self._get_clustering_method(num_predictions, dims)

        kwargs = dict(method=method)
        if clustering_method == "linkage":
            kwargs["preserve_input"] = False
            func = linkage
        else:
            func = linkage_vector

        result_linkage = func(predictions, **kwargs)
        print(result_linkage.shape)
        exit(0)
        num_predictions, dims = predictions.shape

        clustering_method = self._get_clustering_method(num_predictions, dims)

        kwargs = dict(method=method)
        if clustering_method == "linkage":
            kwargs["preserve_input"] = False
            func = linkage
        else:
            func = linkage_vector

        result_linkage = func(predictions, **kwargs)
        print(result_linkage.shape)
        exit(0)
          result_order = self.seriation(result_linkage,
                                        num_predictions,
                                        num_predictions + num_predictions - 2)
  
          return result_order
keep keep keep keep replace replace keep keep keep keep keep
 sort by face - Automatically switch to vector_linkage if not enough free RAM 
lib/vgg_face2_keras.py