Search code examples
pythonstdoutgensim

disable logging for specific lines of code


I am tuning the word2vec model hyper-parameters. Word2Vec has to many log in console that I cannot read Optuna or my custom log. Is there any trick to suppress logs generated by Word2Vec?


Solution

  • I used following code in python 3.7 in python 3.6 we have send logging.ERROR to disable function.

    import logging
    
    logging.disable()
    #your code
    logging.disable(logging.DEBUG)