Keras verbose training progress bar writing a new line on each batch issue

前端 未结 7 1712
余生分开走
余生分开走 2020-12-09 09:09

running a Dense feed-forward neural net in Keras. there are class_weights for two outputs, and sample_weights for a third output. fore some reason it prints the progress ver

7条回答
  •  無奈伤痛
    2020-12-09 09:37

    The solutions of @user11353683 and @Panos can be completed in order to not modify the sources (which can create future problems): just install ipykernel and import it in your code:

    pip install ipykernel Then import ipykernel

    In fact, in the Keras generic_utils.py file, the probematic line was:

                if self._dynamic_display:
                    sys.stdout.write('\b' * prev_total_width)
                    sys.stdout.write('\r')
                else:
                    sys.stdout.write('\n')
    

    And the value self._dynamic_display was initiated such as:

            self._dynamic_display = ((hasattr(sys.stdout, 'isatty') and
                                      sys.stdout.isatty()) or
                                     'ipykernel' in sys.
    

    So, loading ipykerneladded it to sys.modules and fixed the problem for me.

提交回复
热议问题