fix: parameters order assumption in diffuser#706
Draft
kfachikov wants to merge 1 commit into
Draft
Conversation
This change ensures that the inference handler is compatible with diffuser pipelines that do not have a leading positional `prompt` argument, such as Flux2KleinPipeline.
Contributor
Author
|
@begumcig What do you think about reusing I see that you have made such a change in some other metrics a year ago (e.g., here) and wondered whether there was a particular reason why these two were not changed. One small concern with metric_energy is that the current code avoids constantly moving the batch to the "device" and preparing the inputs (as it does it only once - code here. In case we use AFAIU, the metric_model_architecture would not be affected. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This change ensures that the inference handler is compatible with diffuser pipelines that do not have "prompt" as a first parameter, such as Flux2KleinPipeline.
Related Issue
Many diffusers pipelines, such as the Qwen one, have "prompt" as a first parameter. The existing code relied on this assumption - as we can see here,
However, not all diffusers pipelines have the same signature. Flux2KleinPipeline for example expects model on first position and prompt on second. Running a pruna evaluation with the Flux2 model resulted in an error
Important
This change does not remove the resolve the following hypothetical problem.
How?
The change follows the already established patter to unwrap the prepared inputs - the way it's done in PrunaModel.run_inference used in evaluation_agent, the elapsed time metric, and handlethe memory metric.
Type of Change
Testing
uv run pytest -m "cpu and not slow")For full setup and testing instructions, see the Contributing Guide.
Checklist
Thanks for contributing to Pruna! We're excited to review your work.
New to contributing? Check out our Contributing Guide for everything you need to get started.