If providing both embeddings and an embedding model during BERTopic construction, the verbosity of logger will be set to WARNING during .fit regardless of the verbose parameter.
On the last line, self.verbose is not passed like it is when embeddings is not passed. Patching the function to include this parameter works as expected. I can make a PR with this fix, unless this was a purposeful design decision.
To be clear, my proposed solution is to change line 440 from
I think the strategy of modifying the level of the top-level logger based on the verbose setting within a BERTopic instance may be error-prone and subject to race condition problems if multiple threads are working with BERTopic instances with varying verbose settings. I believe a better long term solution to logging is constructing a new logger per BERTopic instantiation, but that is out of the scope of this issue.
Have you searched existing issues? 🔎
Desribe the bug
If providing both embeddings and an embedding model during
BERTopic
construction, the verbosity oflogger
will be set toWARNING
during.fit
regardless of theverbose
parameter.https://github.com/MaartenGr/BERTopic/blob/bf1fedd5bb14bbf282d5051e849d2b06abaa8b51/bertopic/_bertopic.py#L427-L440
On the last line,
self.verbose
is not passed like it is whenembeddings
is not passed. Patching the function to include this parameter works as expected. I can make a PR with this fix, unless this was a purposeful design decision.To be clear, my proposed solution is to change line 440 from
to
I think the strategy of modifying the level of the top-level logger based on the
verbose
setting within aBERTopic
instance may be error-prone and subject to race condition problems if multiple threads are working withBERTopic
instances with varyingverbose
settings. I believe a better long term solution to logging is constructing a new logger perBERTopic
instantiation, but that is out of the scope of this issue.BERTopic Version
0.16.2