-
Couldn't load subscription status.
- Fork 6.5k
[benchmarks] overhaul benchmarks #11565
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
Merged
Changes from 81 commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
24a46cc
start overhauling the benchmarking suite.
sayakpaul ab7f381
fixes
sayakpaul cc0a38a
fixes
sayakpaul 169f831
checking.
sayakpaul ad18983
checking
sayakpaul 31e34d5
fixes.
sayakpaul 36afdea
error handling and logging.
sayakpaul 0d3af90
Merge branch 'main' into benchmarking-overhaul
sayakpaul fd85fbc
Merge branch 'main' into benchmarking-overhaul
sayakpaul a2c03a4
Merge branch 'main' into benchmarking-overhaul
sayakpaul 4d83a47
add flops and params.
sayakpaul 6815cae
add more models.
sayakpaul 5635bf8
utility to fire execution of all benchmarking scripts.
sayakpaul cfbd21e
utility to push to the hub.
sayakpaul 4ccfad0
push utility improvement
sayakpaul dff3144
seems to be working.
sayakpaul accd598
okay
sayakpaul 41f79a0
add torchprofile dep.
sayakpaul befdd9e
remove total gpu memory
sayakpaul 4784b8b
fixes
sayakpaul c19dc5b
fix
sayakpaul 2da4fac
need a big gpu
sayakpaul 7367bb1
better
sayakpaul 1cd472f
what's happening.
sayakpaul 214795d
okay
sayakpaul 7d4f459
Merge branch 'main' into benchmarking-overhaul
sayakpaul 2d5b305
Merge branch 'main' into benchmarking-overhaul
sayakpaul dd42244
Merge branch 'main' into benchmarking-overhaul
sayakpaul 9d28606
Merge branch 'main' into benchmarking-overhaul
sayakpaul ffed3b3
Merge branch 'main' into benchmarking-overhaul
sayakpaul a28c881
Merge branch 'main' into benchmarking-overhaul
sayakpaul 90b9b42
Merge branch 'main' into benchmarking-overhaul
sayakpaul 64186b4
Merge branch 'main' into benchmarking-overhaul
sayakpaul dfb20b0
Merge branch 'main' into benchmarking-overhaul
sayakpaul 1b0de9b
Merge branch 'main' into benchmarking-overhaul
sayakpaul 1122cad
separate requirements and make it nightly.
sayakpaul baa92c2
add db population script.
sayakpaul 9e1f17f
update secret name
sayakpaul 71200da
update secret.
sayakpaul 1136f92
Merge branch 'main' into benchmarking-overhaul
sayakpaul d10024c
Merge branch 'main' into benchmarking-overhaul
sayakpaul e45e4eb
population db update
sayakpaul 4a60155
disable db population for now.
sayakpaul 8dd326f
Merge branch 'main' into benchmarking-overhaul
sayakpaul e0ccb60
change to every monday
sayakpaul 61dd029
Update .github/workflows/benchmark.yml
sayakpaul ee0fcd4
quality improvements.
sayakpaul e35ffe8
reparate hub upload step.
sayakpaul d3c494a
repository
sayakpaul ce8d1ec
remove csv
sayakpaul fc69eb8
check
sayakpaul a43e8ef
update
sayakpaul 2f5c8d0
update
sayakpaul 1f7587e
threading.
sayakpaul 7a935a4
update
sayakpaul a6c7359
update
sayakpaul 1150cb0
updaye
sayakpaul 6cc4707
update
sayakpaul f1ee631
update
sayakpaul 73e07ba
update
sayakpaul 2a65a89
remove peft dep
sayakpaul dc778b0
upgrade runner.
sayakpaul 8ddf57c
fix
sayakpaul 8161e36
fixes
sayakpaul 807f511
fix merging csvs.
sayakpaul 2dbdfe0
Merge branch 'main' into benchmarking-overhaul
sayakpaul a09768f
push dataset to the Space repo for analysis.
sayakpaul 1683c47
warm up.
sayakpaul d1fb620
Merge branch 'main' into benchmarking-overhaul
sayakpaul 858dc09
add a readme
sayakpaul 6bfdae6
Apply suggestions from code review
sayakpaul 6b11973
address feedback
sayakpaul ba7a89c
Apply suggestions from code review
sayakpaul f9285fd
disable db workflow.
sayakpaul 9017a2c
Merge branch 'main' into benchmarking-overhaul
sayakpaul f9d4345
Merge branch 'main' into benchmarking-overhaul
sayakpaul 5792608
Merge branch 'main' into benchmarking-overhaul
sayakpaul 3ae040c
Merge branch 'main' into benchmarking-overhaul
sayakpaul d9950cd
Merge branch 'main' into benchmarking-overhaul
sayakpaul 9e235e8
Merge branch 'main' into benchmarking-overhaul
sayakpaul aac27f0
Merge branch 'main' into benchmarking-overhaul
sayakpaul 6bf5b36
update to bi weekly.
sayakpaul 736f22e
Merge branch 'main' into benchmarking-overhaul
sayakpaul 18c4361
Merge branch 'main' into benchmarking-overhaul
sayakpaul 4bdb865
enable population
sayakpaul ca81c6e
enable
sayakpaul 1745e45
Merge branch 'main' into benchmarking-overhaul
sayakpaul 26775e5
updaye
sayakpaul 64331b2
update
sayakpaul 01bd03e
metadata
sayakpaul a76a236
fix
sayakpaul 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # Diffusers Benchmarks | ||
|
|
||
| Welcome to Diffusers Benchmarks. These benchmarks are use to obtain latency and memory information of the most popular models across different scenarios such as: | ||
|
|
||
| * Base case i.e., when using `torch.bfloat16` and `torch.nn.functional.scaled_dot_product_attention`. | ||
| * Base + `torch.compile()` | ||
| * NF4 quantization | ||
| * Layerwise upcasting | ||
|
|
||
| Instead of full diffusion pipelines, only the forward pass of the respective model classes (such as `FluxTransformer2DModel`) is tested with the real checkpoints (such as `"black-forest-labs/FLUX.1-dev"`). | ||
|
|
||
| The entrypoint to running all the currently available benchmarks is in `run_all.py`. However, one can run the individual benchmarks, too, e.g., `python benchmarking_flux.py`. It should produce a CSV file containing various information about the benchmarks run. | ||
|
|
||
| The benchmarks are run on a weekly basis and the CI is defined in [benchmark.yml](../.github/workflows/benchmark.yml). | ||
|
|
||
| ## Running the benchmarks manually | ||
|
|
||
| First set up `torch` and install `diffusers` from the root of the directory: | ||
|
|
||
| ```py | ||
| pip install -e ".[quality,test]" | ||
| ``` | ||
|
|
||
| Then make sure the other dependencies are installed: | ||
|
|
||
| ```sh | ||
| cd benchmarks/ | ||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| We need to be authenticated to access some of the checkpoints used during benchmarking: | ||
|
|
||
| ```sh | ||
| huggingface-cli login | ||
| ``` | ||
|
|
||
| We use an L40 GPU with 128GB RAM to run the benchmark CI. As such, the benchmarks are configured to run on NVIDIA GPUs. So, make sure you have access to a similar machine (or modify the benchmarking scripts accordingly). | ||
|
|
||
| Then you can either launch the entire benchmarking suite by running: | ||
|
|
||
| ```sh | ||
| python run_all.py | ||
| ``` | ||
|
|
||
| Or, you can run the individual benchmarks. | ||
|
|
||
| ## Customizing the benchmarks | ||
|
|
||
| We define "scenarios" to cover the most common ways in which these models are used. You can | ||
| define a new scenario, modifying an existing benchmark file: | ||
|
|
||
| ```py | ||
| BenchmarkScenario( | ||
| name=f"{CKPT_ID}-bnb-8bit", | ||
| model_cls=FluxTransformer2DModel, | ||
| model_init_kwargs={ | ||
| "pretrained_model_name_or_path": CKPT_ID, | ||
| "torch_dtype": torch.bfloat16, | ||
| "subfolder": "transformer", | ||
| "quantization_config": BitsAndBytesConfig(load_in_8bit=True), | ||
| }, | ||
| get_model_input_dict=partial(get_input_dict, device=torch_device, dtype=torch.bfloat16), | ||
| model_init_fn=model_init_fn, | ||
| ) | ||
| ``` | ||
|
|
||
| You can also configure a new model-level benchmark and add it to the existing suite. To do so, just defining a valid benchmarking file like `benchmarking_flux.py` should be enough. | ||
|
|
||
| Happy benchmarking 🧨 |
Empty file.
Oops, something went wrong.
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.
Not a blocker. But why run every week? Is a monthly benchmark not sufficient?
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.
True. Changing to bi-weekly.