Skip to content

Commit

Permalink
Fix calls to self.verbose in class methods (#2039)
Browse files Browse the repository at this point in the history
  • Loading branch information
freddyheppell authored Jun 13, 2024
1 parent df7116d commit b544ba7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bertopic/_bertopic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit b544ba7

Please sign in to comment.