replicate / cog

Containers for machine learning
https://cog.run
Apache License 2.0
7.87k stars 549 forks source link

Support simple TTY control characters to make progress bars work #614

Open bfirsh opened 2 years ago

bfirsh commented 2 years ago

It'd be neat if progress bars didn't turn into a Christmas tree in the logs. If it returns to the start of the line, it should just overwrite the last log line.

Inspired by @zeke's comment about progress being shown on models.

zeke commented 2 years ago
>
=>
==>
===>
====>
=====>
bfirsh commented 2 years ago

Reminded of this by clipasso https://replicate.com/yael-vinker/clipasso

evilstreak commented 2 years ago

I've written a failing test case for this, which will hopefully help guide development: https://github.com/replicate/cog/compare/614-progress-bars-in-logs

I fear the implementation might be tricky, as we're capturing the log output from stdout and stderr and I'm not sure we're actually getting those control characters through the way we're currently handling it.