Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to configure the behaviour of StandardRenderer #15

Open
kretes opened this issue Nov 30, 2021 · 1 comment
Open

Allow to configure the behaviour of StandardRenderer #15

kretes opened this issue Nov 30, 2021 · 1 comment

Comments

@kretes
Copy link

kretes commented Nov 30, 2021

Currently we use StandardRenderer with no_update=True and it is used in a process that uses tqdm (keras training loop).
The effect is that the first line from ticktock is appended at the end of the line of current tqdm progress.
I can see in https://github.com/victorbenichoux/ticktock/blob/main/ticktock/std.py#L137 there is a new line appended at the end of ticktock output. We would like to add a new line at the beginning as well. WDYT of either including it be default or allowing to customize it by the client?

@victorbenichoux
Copy link
Owner

Hi @kretes !

Thanks for the feedback. As you can see, I have been struggling quite a bit with the tqdm integration, and I have not quite been able to make it work with updates 😬 .

I am not able to reproduce the behavior you are describing, although I may be doing something wrong. I am testing with the following code:

import time
import tqdm
from ticktock import set_format, set_period, tick

set_period(0)
set_format(no_update=True)

which = "in"

for _ in range(2):
    t_out = tick(enabled=which == "out")
    for aa in tqdm.tqdm(range(2)):
        t_in = tick(which == "in")
        time.sleep(0.1)
        t_in.tock()
    t_out.tock()

I am switching between which="in" and which="out" and in both cases, the ticktock lines seem to be correctly generated. In addition, adding a new line at the beginning of each block introduces blank lines. So I figure I must be doing something wrong.

Could you give me more information to reproduce the issue? I am really happy to take any suggestion, and if it turns out that adding a newline fixes it for you, I will add in a way to allow the user to do so 😄 . If you can not provide a simple example, I guess we're on the same time zone so we can probably work something out!

In any event, I do do need to go back and fix the behavior with tqdm. If you want to help out feel free!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants