docs: update Flux tutorial as a more general image generation tutorial#127
Conversation
5b9d1de to
79e5544
Compare
|
@nifleisch, that looks good! I would leave the printed statements in the tutorials so people can actually read the output and understand better what is happening. |
I see your point. This way, users could follow the tutorial without running it on their own machines. I just spoke with Johanna, and we’re now clearing the outputs of all tutorial notebooks by default. So even if outputs remain in the tutorial, they won’t be included in the documentation. |
|
That's good to know. Let's remove the output clearing, then. I think the output helps understanding, so it is fine to keep them, but feel free to verify with @johannaSommer since we initially decided to remove them. |
Good point. I just checked with @johannaSommer, and she’s on board with this as well. Will add them back to the tutorial. |
fe9f419 to
ed412f9
Compare
There was a problem hiding this comment.
THanks for the tutorial. Here are my comments on the ntoebook :)
- I like the idea of a tutorial card at the top but it could be made cleaner (e.g. in a table?). I would also not mention the distinciton between metrics. The term "base/statefull" is more a implementation relevant rather than a user relevant. I would also remove the libraries from there.
- Do we need to show how ot install pruna? We do not do this in the other tutorialx and have a doc page for it.
- We could merge the set device cell with theload model cell
- Could we have "1., 2. 3." in subtitles like in other tutorials?
- We could mention how long is the smashing for this smash config so that peopl know what to expect.
- Define all metrics in a single list.
first_results- >base_model_results(andsmashed_model_results.- Could we print all metrics in a nice way in a single cell? i.e. merge cell 9. 10. 11.?
- Is this tutorial only with SD2.1? Make sense since it is quick to run but also unclear since a bit outdated.
7137812 to
c6f5b01
Compare
There was a problem hiding this comment.
Thanks for the udpate! Here are still some left comments:
- Let's remove the library row from the table
- Do we need to show how ot install pruna? We do not do this in the other tutorialx and have a doc page for it. I would suggest o redicrect to the installation page if people need.
- We could merge the "set device" cell with the "load model" cell
- Let's have numbers for sections like in other tutorials. Could we have "1., 2. 3." in subtitles like in other tutorials? :)
- I feel that we could find a nicer way to print the metrics e.g. the python print a small table with metrics before/after and relative difference in 3 columns.
- I feel that a small intro at the start of the tutorial to explain what we try to do and that it can work with other model than SD2.1 would be nice to give context
- We should also update the title of the notebook itself for "Compress and evaluate"
|
Hi @sharpenb, I think I once typed a response already but did not post it. Underneath are some of my reasons for the choices.
sure
Yes, but if people want to run this as a standalone notebook, let's say in Jupyter or Google Colab or whatever other IDE, we need to install Pruna.
I kept this separate as it is a bit more explicit and the device is used in multiple places throughout the notebook
I left this out because I don't feel it adds value, and it makes it more challenging to maintain as it is a manual process.
I agree it could be nicer, but do you feel this is worth spending 30 minutes on (re-running the notebook evals and such)?
If you feel it is important to use a more modern model, I am happy to set that up, but I think it makes it
I think it is better to keep it more general, although the specific techniques we apply focus on compression. |
|
@nifleisch @sharpenb @SaboniAmine could you review this PR, I think it would be nice to merge before the release. |
…rial - Deleted the `flux_small.ipynb` tutorial as it is no longer relevant. - Introduced `image_generation.ipynb` tutorial to demonstrate optimizing and evaluating image generation models using the `pruna` package, including details on optimization algorithms and evaluation metrics. - Updated the tutorial index to reflect these changes.
…setup instructions - Added installation instructions for the `pruna` package. - Included a section on setting the device for optimization, ensuring users can utilize the best available hardware.
…ation details - Changed language ID in the notebook metadata for better compatibility. - Added sections for loading the model and tokenizer, including a specific example using the CompVis/stable-diffusion-v1-4 model. - Included code snippets for model optimization and evaluation, enhancing the tutorial's comprehensiveness. - Updated tutorial index to reflect changes in the image generation process.
…ts and output enhancements - Updated execution counts for several code cells to ensure proper sequencing. - Modified output messages for improved clarity and accuracy during model evaluation. - Adjusted configuration parameters for the `hqq_diffusers` quantizer to optimize performance. - Added new image outputs to enhance the visual representation of results.
- Reformatted the introduction section into a table for better readability. - Enhanced explanations regarding model optimization and evaluation metrics. - Updated code snippets for consistency and improved execution flow. - Removed unnecessary output cells to streamline the tutorial experience.
…ents - Updated model reference to [segmind/Segmind-Vega] for improved performance. - Revised evaluation metrics to include `throughput` and `total time`. - Adjusted execution counts for code cells to maintain proper flow. - Enhanced output display for clearer metric comparisons during evaluation.
- Changed model saving and loading references from "stable-diffusion-2-1-smashed" to "segmind-vega-smashed" for consistency with recent updates. - Updated corresponding comments to reflect the new model name.
- Clarified the output quality discussion by removing redundant phrasing regarding the CLIP score, enhancing the overall readability of the section.
- Removed `elapsed_time` from the evaluation metrics to focus on key performance indicators. - Cleared unnecessary output cells to enhance the tutorial's clarity and flow.
- Changed the tutorial title from "Optimize and Evaluate Image Generation Models" to "Compress and Evaluate Image Generation Models" for clarity. - Added numbered sections to improve navigation and organization within the tutorial. - Removed unnecessary metadata from code cells to streamline the content.
2fff38d to
94302a3
Compare
sharpenb
left a comment
There was a problem hiding this comment.
Thanks for the update! A last update before merging would be to indicate the units with througput (samples/s), latency (s/samples) and Base Model, Compressed Model, Relative Difference in the row/columns names to be complete :)
- Replaced `TotalTimeMetric` with `LatencyMetric` to better reflect performance evaluation. - Updated markdown table headers and content for clarity, changing "Original" and "Optimized" to "Base Model" and "Compressed Model" respectively. - Added units to the markdown table for improved understanding of metric values.
|
hi @sharpenb I resolved your comments. |
nifleisch
left a comment
There was a problem hiding this comment.
I love the new tutorial, it feels very complete. Through it I learned about the amazing segmind/Segmind-Vega model that we probably should use more often for tutorials as it looks stunning!
Two minor things:
- At the beginning of the tutorial in section 1 there is a typo "howwever"
- In the last part you use both the throughput and the latency metric, which felt a bit redundant to me because throuput ~ 1 / latency. Instead I would have preferred a fidelity measure. (feel free to ignore this suggestion)
flux_small.ipynbtutorial as it is no longer relevant.image_generation.ipynbtutorial to demonstrate optimizing and evaluating image generation models using theprunapackage, including details on optimization algorithms and evaluation metrics.Description
Related Issue
Fixes #(issue number)
Type of Change
How Has This Been Tested?
Checklist
Additional Notes