File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3346,12 +3346,18 @@ def save(
33463346
33473347 # Additional
33483348 if save_ctfidf :
3349- save_utils .save_ctfidf (
3350- model = self ,
3351- save_directory = save_directory ,
3352- serialization = serialization ,
3353- )
3354- save_utils .save_ctfidf_config (model = self , path = save_directory / "ctfidf_config.json" )
3349+ if self .c_tf_idf_ is None :
3350+ logger .warning (
3351+ "The c-TF-IDF matrix could not be saved as it was not found. "
3352+ "This typically occurs when merging BERTopic models with `BERTopic.merge_models`."
3353+ )
3354+ else :
3355+ save_utils .save_ctfidf (
3356+ model = self ,
3357+ save_directory = save_directory ,
3358+ serialization = serialization ,
3359+ )
3360+ save_utils .save_ctfidf_config (model = self , path = save_directory / "ctfidf_config.json" )
33553361
33563362 @classmethod
33573363 def load (cls , path : str , embedding_model = None ):
You can’t perform that action at this time.
0 commit comments