showTrainingProgress

Help Info

Takes the logs from training and shows them with a little TUI.

usage: showTrainingProgress [-h] [--no-exit]
                            [--exit-delay EXITDELAY]
                            [--delay DELAY]
                            [--read-tty READTTY]
                            [--no-debug]
                            [--message-height MESSAGEHEIGHT]

Named Arguments

--no-exit

Instead of exiting 10 seconds after the training is done, keep this window open so you can look at numbers.

Default: False

--exit-delay

Pause for this many seconds after training is complete before closing the window.

Default: 10

--delay

After reading a line, pause for this many milliseconds.

Default: 0

--read-tty

Allow the program to read from a terminal. There are no good times to use this except for debugging.

--no-debug

Don’t show debug-level messages.

Default: False

--message-height

The height (rows) of the message area at the bottom of the window.

Usage

A little program that displays progress information as a model trains.

bpreveal.showTrainingProgress.isNormalMessage(msg)

Is this something that we usually see during training?

Parameters:

msg (str) – The line from the input file.

Returns:

True if this is normal BPReveal output, False if the user should be alerted.

Return type:

bool

class bpreveal.showTrainingProgress.Screen(stdscr, noDebug, border, colSep, statusHeight, messageHeight)

A utility to draw tables from the logs of the training script.

Parameters:
  • stdscr – The curses screen, generated by a call to wrapper()

  • noDebug (bool) – If true, don’t show debug messages.

  • border (int) – How many character spaces should be kept around the screen edge?

  • colSep (int) – How many spaces between boxes?

  • statusHeight (int) – How tall should the status box be?

  • messageHeight (int | None) – How tall should the message and debug panels be? Note that this is for each panel, so the message and debug panels together will occupy 2 * messageHeight + colSep rows.

exitTime: int

How long should the printer wait around after a successful exit?

printString(row, col, winName, text, color=None)

Print a given string at a location in a window.

Parameters:
  • row (int) – What row within the window should the string start at?

  • col (int) – What column should the string start at?

  • winName (str) – Which window? One of SEB:math:`{\lambda}`MD.

  • text (str) – The text to display.

  • color (int | None) – If provided, the output from curses.color_pair().

Return type:

None

updateStatus(winName)

Update the status box to indicate which area is active.

Parameters:

winName (str) – A character, one of B:math:`{\lambda}`EMDX If winName is X or F, starts the shutdown process. X indicates successful termination, F indicates that the end message was not seen.

Return type:

None

shutdown(winName)

Keep the display up for a bit, then close it out.

Parameters:

winName (str) – Either X or F. If X, make the window green and show a happy message; if F, make the window red and display a sad message.

Return type:

None

addLine(line)

Take a line from the log and put the info in the right place.

Parameters:

line (str) – A line from a BPReveal log file.

Returns:

True if more lines are expected, False if it’s time to shut down.

Return type:

bool

The return value is important because a program like tail won’t know that no more input will be added to the logs, but we can look for a line that contains Training job completed successfully and know it’s time to quit. Lines that have position information will contain a double integral sign as a delimiter, like this:

\(\tt INFO : 2024-02-14 13:39:11 :callbacks.py:207 : \iint{}2\iint{}30\iint{}E\iint{} 47 / 200\)

The entries are, in order: row, column, window, message. A window may be two characters, the second one being either H or A, meaning that the text should be shown in green or red, respectively.

If a line does not contain “\(\tt \iint\)”, then it is displayed in the message tab or the debug tab. The debug tab is reserved for messages starting with the string DEBUG, and messages gets everything else.

bpreveal.showTrainingProgress.getParser()

Command line arguments, all optional.

Return type:

ArgumentParser

bpreveal.showTrainingProgress.runScreen(stdscr, args)

Called by the wrapper, this constructs the screen and feeds it with stdin.

Parameters:
  • stdscr (Any)

  • args (Namespace)

Return type:

None