-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Refactor progress bar #242
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
Merged
patrickvonplaten
merged 9 commits into
huggingface:main
from
hysts:refactor-progress-bar
Aug 30, 2022
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fda6308
Refactor progress bar of pipeline __call__
hysts 3aa44e8
Make any tqdm configs available
hysts 72f180d
remove init
patrickvonplaten 1840f32
Merge branch 'main' of https://github.com/huggingface/diffusers into …
patrickvonplaten 71881d4
add some tests
patrickvonplaten 6988892
remove file
patrickvonplaten f92a04a
finish
patrickvonplaten caaf00a
make style
patrickvonplaten 28311a9
improve progress bar test
patrickvonplaten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,29 @@ | |
| torch.backends.cuda.matmul.allow_tf32 = False | ||
|
|
||
|
|
||
| def test_progress_bar(capsys): | ||
| model = UNet2DModel( | ||
| block_out_channels=(32, 64), | ||
| layers_per_block=2, | ||
| sample_size=32, | ||
| in_channels=3, | ||
| out_channels=3, | ||
| down_block_types=("DownBlock2D", "AttnDownBlock2D"), | ||
| up_block_types=("AttnUpBlock2D", "UpBlock2D"), | ||
| ) | ||
| scheduler = DDPMScheduler(num_train_timesteps=10) | ||
|
|
||
| ddpm = DDPMPipeline(model, scheduler).to(torch_device) | ||
| ddpm(output_type="numpy")["sample"] | ||
| captured = capsys.readouterr() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice test, gonna remember this ;) |
||
| assert "10/10" in captured.err, "Progress bar has to be displayed" | ||
|
|
||
| ddpm.set_progress_bar_config(disable=True) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. simple way to turn off the progress bar |
||
| ddpm(output_type="numpy")["sample"] | ||
| captured = capsys.readouterr() | ||
| assert captured.err == "", "Progress bar should be disabled" | ||
|
|
||
|
|
||
| class PipelineTesterMixin(unittest.TestCase): | ||
| def test_from_pretrained_save_pretrained(self): | ||
| # 1. Load models | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As for
enumerateandtqdm, if the order isenumerate(tqdm(...)), we don't have to passtotal.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.
Agree that's what it states in the
tqdmdocs: https://pypi.org/project/tqdm/#faq-and-known-issues