-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Forward tqdm
constructor arguments to Progress
component
#4475
Forward tqdm
constructor arguments to Progress
component
#4475
Conversation
Signed-off-by: Ilya Trushkin <[email protected]>
Signed-off-by: Ilya Trushkin <[email protected]>
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4475-all-demos |
gradio/helpers.py
Outdated
@@ -546,15 +546,15 @@ def create_tracker(root_blocks, event_id, fn, track_tqdm): | |||
if not hasattr(root_blocks, "_progress_tracker_per_thread"): | |||
root_blocks._progress_tracker_per_thread = {} | |||
|
|||
def init_tqdm(self, iterable=None, desc=None, *args, **kwargs): | |||
def init_tqdm(self, iterable=None, desc=None, total=None, unit='steps', *args, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the default value for unit
in tqdm.tqdm
is it
:
def init_tqdm(self, iterable=None, desc=None, total=None, unit='steps', *args, **kwargs): | |
def init_tqdm(self, iterable=None, desc=None, total=None, unit='it', *args, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep the same behavior, I used the default gradio
value for unit
used in:
Line 480 in 06808df
unit: str = "steps", |
Should I use tqdm
value instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm good point. @aliabid94 can you review this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
steps is better, this is what will be displayed in the frontend
Thanks @itrushkin for the nice PR. LGTM and can confirm it solves the original issue. Please see my comment above and in addition, two suggestions:
Should be good to merge then |
Thanks a lot. To track the progress of hyperparameter tuning with optuna, I applied this PR and added tqdm.set_description wrapper in create_tracker function. Is there any possibility that set_description or set_postfix wrapper will also be added in gr.Progress? |
Hi @itrushkin would you be interested in making the suggested changes? |
Let us know once you have the test in place @itrushkin |
I'll go ahead and make the changes above so that we can merge this in |
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4475-all-demos |
Merging, thanks again for the contribution @itrushkin |
* Forward tqdm constructor arguments to Progress component Signed-off-by: Ilya Trushkin <[email protected]> * lint * reorder args * added tests --------- Signed-off-by: Ilya Trushkin <[email protected]> Co-authored-by: Abubakar Abid <[email protected]>
* playwright tests for chatbot * more tests * changelog * Update CHANGELOG.md * fix upload file delay (#4661) * fix * changes * changes --------- Co-authored-by: Abubakar Abid <[email protected]> * Forward `tqdm` constructor arguments to `Progress` component (#4475) * Forward tqdm constructor arguments to Progress component Signed-off-by: Ilya Trushkin <[email protected]> * lint * reorder args * added tests --------- Signed-off-by: Ilya Trushkin <[email protected]> Co-authored-by: Abubakar Abid <[email protected]> * Remove cleared_value (#4685) * Remove cleared_value * CHANGELOG * Add requirements.txt to dialogpt demo (#4686) * Add requirements.txt * Update demo notebook * Add torch * remove streaming demo + more tests * Fix blocks_kitchen_sink and streaming_stt demos (#4699) * Add code * Add json file * Remove streaming_stt demo * Undo generate_notebooks * Add blocks_kitchen_sink * fix tests * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <[email protected]> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <[email protected]> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <[email protected]> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <[email protected]> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <[email protected]> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <[email protected]> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <[email protected]> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <[email protected]> * Update js/app/test/chatbot_multimodal.spec.ts Co-authored-by: pngwn <[email protected]> * update notebook * remove debug * remove debug --------- Signed-off-by: Ilya Trushkin <[email protected]> Co-authored-by: aliabid94 <[email protected]> Co-authored-by: Abubakar Abid <[email protected]> Co-authored-by: Ilya Trushkin <[email protected]> Co-authored-by: Freddy Boulton <[email protected]> Co-authored-by: pngwn <[email protected]>
Description
Progress
component withtqdm
tracking enabled could not be rendered when noiterable
is specified intqdm
initialization.This PR forwards the
total
andunit
keyword arguments that are used byProgress.tqdm
method.Example code
Render result
main
branchChecklist: