Keras Model.fit Verbose Formatting

后端 未结 2 973
情书的邮戳
情书的邮戳 2021-02-04 11:37

I\'m running Keras model.fit() in Jupyter notebook, and the output is very messy if verbose is set to 1:

    Train on 6400 samples, validate on 800 samples
    E         


        
2条回答
  •  渐次进展
    2021-02-04 12:43

    Took me a while to see this but tqdm (version >= 4.41.0) has also just added built-in support for keras so you could do:

    from tqdm.keras import TqdmCallback
    ...
    model.fit(..., verbose=0, callbacks=[TqdmCallback(verbose=2)])
    

    This turns off keras' progress (verbose=0), and uses tqdm instead. For the callback, verbose=2 means separate progressbars for epochs and batches. 1 means clear batch bars when done. 0 means only show epochs (never show batch bars).

    If there are any issues with it please feel free to post on https://github.com/tqdm/tqdm/issues

提交回复
热议问题