From b544ba7fac28136a61a2db66ffcc1c68528954f3 Mon Sep 17 00:00:00 2001 From: Freddy Heppell Date: Thu, 13 Jun 2024 17:54:15 +0100 Subject: [PATCH] Fix calls to self.verbose in class methods (#2039) --- bertopic/_bertopic.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bertopic/_bertopic.py b/bertopic/_bertopic.py index cc37b79c..016d2c9c 100644 --- a/bertopic/_bertopic.py +++ b/bertopic/_bertopic.py @@ -3162,7 +3162,7 @@ def load(cls, with open(file_or_dir, 'rb') as file: if embedding_model: topic_model = joblib.load(file) - topic_model.embedding_model = select_backend(embedding_model, verbose=self.verbose) + topic_model.embedding_model = select_backend(embedding_model, verbose=topic_model.verbose) else: topic_model = joblib.load(file) return topic_model @@ -3179,7 +3179,7 @@ def load(cls, # Replace embedding model if one is specifically chosen if embedding_model is not None: - topic_model.embedding_model = select_backend(embedding_model) + topic_model.embedding_model = select_backend(embedding_model, verbose=topic_model.verbose) return topic_model @@ -3312,8 +3312,9 @@ def merge_models(cls, models, min_similarity: float = .7, embedding_model=None): merged_model.embedding_model = models[0].embedding_model # Replace embedding model if one is specifically chosen + verbose = any([model.verbose for model in models]) if embedding_model is not None and type(merged_model.embedding_model) == BaseEmbedder: - merged_model.embedding_model = select_backend(embedding_model, verbose=self.verbose) + merged_model.embedding_model = select_backend(embedding_model, verbose=verbose) return merged_model def push_to_hf_hub(