Running CNN in Keras. When it starts to run model.fit
, it prints progress bar for each batch, like this
Is it possible to display the progress bar for each epoch? Like this
Here is how I am using model.fit(x_train, y_train, nb_epoch = 1, batch_size = 32, verbose=1)
I have tried to set verbose
to 0 and 2, but there is no progress bar.
Please let me know if you have any thoughts. Many thanks
I gave a solution (not sure if can work for every case, but worked well for me) in https://stackoverflow.com/a/57475559/9531617. To quote myself:
The problem can be fixed without modifying the sources by simply installing ipykernel
and importing it in your code:
pip install ipykernel
Then
import ipykernel
In fact, in the Keras generic_utils.py file, the probematic line was (in my case):
if self._dynamic_display:
sys.stdout.write('\b' * prev_total_width)
sys.stdout.write('\r')
else:
sys.stdout.write('\n')
Where the self._dynamic_display
was False
, whereas it needed to be True to work properly. But the value self._dynamic_display was initiated such as:
self._dynamic_display = ((hasattr(sys.stdout, 'isatty') and
sys.stdout.isatty()) or
'ipykernel' in sys.modules)
So, loading ipykernel
added it to sys.modules
and fixed the problem for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With