0

I have an nvidia-docker container running, I have bash'd into it with

sudo docker exec -it container_name bash

and starting running a Python script which trains a model with Keras

python main.py

After some general output the script begins training. During training the Keras library will print information to the output pertaining to the training status, something along the lines of

Epoch 20/20 4352/17633 [======>.......................] - ETA: 2s - loss: 210.3123 - mean_squared_error: 210.312

At each change in training status, while not "in" the container this output line will simply be "written over" so that only one line is ever printed.


My current issue is that while "in" the container this single line output is not overwritten. Instead a newline is always produced making the output look like so

Epoch 20/20
128/17633 [..............................] - ETA: 2s - loss: 233.8922 - mean_squared_error: 233.892  
512/17633 [..............................] - ETA: 2s - loss: 201.6697 - mean_squared_error: 201.669  
896/17633 [>.............................] - ETA: 2s - loss: 207.2686 - mean_squared_error: 207.268 
1280/17633 [=>............................] - ETA: 2s - loss: 197.1828 - mean_squared_error: 197.182 
1664/17633 [=>............................] - ETA: 2s - loss: 204.2927 - mean_squared_error: 204.292 
2048/17633 [==>...........................] - ETA: 2s - loss: 209.5730 - mean_squared_error: 209.573 
2432/17633 [===>..........................] - ETA: 2s - loss: 207.6647 - mean_squared_error: 207.664 
2816/17633 [===>..........................] - ETA: 2s - loss: 211.7252 - mean_squared_error: 211.725 
3200/17633 [====>.........................] - ETA: 2s - loss: 208.8681 - mean_squared_error: 208.868 
3584/17633 [=====>........................] - ETA: 2s - loss: 209.8008 - mean_squared_error: 209.800 
3968/17633 [=====>........................] - ETA: 2s - loss: 209.7730 - mean_squared_error: 209.773 
4352/17633 [======>.......................] - ETA: 2s - loss: 210.3123 - mean_squared_error: 210.312

While this is not a huge issue, it makes it very difficult to follow the training status and review it when complete; especially when larger longer running models (order of hours) are trained.


Is there a way to "connect"/"bash" into the Docker container so that it prints the Python output as expected?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.