sjmikler / progress-table

Display progress as a pretty table in the command line.
MIT License
90 stars 3 forks source link

Is there a way to customize the progress bar so that it takes in {steps}/{total_steps} instead of time elapsed? #2

Closed hungcs closed 10 months ago

hungcs commented 11 months ago

I would like the progress bar to be something like 4/1000 steps, and have it update each time we get a step update from a training run.

sjmikler commented 11 months ago

Hi! Thanks for creating the Issue.

Can you copy over a table and manually add the progress bar you'd like so I can see what you mean?

Is it still a progress bar if it doesn't display a bar but only a number like 4/1000 steps?

As an alternative, you could add a column to the table and update the progress by yourself.

table.add_column("progress")
num_steps = 1000

for step in range(num_steps):
    table["progress"] = f"{step}/{num_steps}"

How does it sound?

sjmikler commented 11 months ago

Or are you just asking to replace the throughput information with {steps}/{total_steps} while still displaying a bar?

This

[ 10/1000] □□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□

Instead of this

[0.00 it/s] □□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□

?

hungcs commented 11 months ago

Yes exactly, the example you posted looks great!

[ 10/1000] □□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□

and then we would want to manually update the steps counter whenever we get a websocket update from our training backend

sjmikler commented 10 months ago

There are new arguments available starting in version 0.1.27.

You can specify default behavior:

ProgressTable(
        ...
        default_show_throughput: bool = True,
        default_show_progress: bool = False,
        ...
)

And you can specify per iter behavior:

table(iterator, show_throughput=False, show_progress=True)

So with both show_throughput=True and show_progress=True, you will get something like this:

│ [1.00 it/s, 5/10] ■■■■■■■■■■■■■■■■■■□□□□□□□□□□□□□□□□□□ │

But you can selectively disable throughput if you don't like it.