Skip to content Skip to sidebar Skip to footer

Reading A Training Progress Log File, But Binaries Are Written In It

I was running a program, and it will output the progress bar to a file train.2.log. Here's a link to the file train.2.log, which looks like the following on terminal : This is line

Solution 1:

The problem seems to be that you output both training progress & it's log to the same output stream. If you got the train.2.log by redirecting the Python output to a file in terminal (app.py > train.log), but still want to observe it's progress, then I'd suggest printing the log to a separate stream, like stderr.

You can achieve that in Python with print("Log message", file=sys.stderr), then redirect program output:

app.py 2>train.log

This way app.py will print the progress bar to stdout as usual, while the training log is available on stderr without progress indication mixed in.

Post a Comment for "Reading A Training Progress Log File, But Binaries Are Written In It"