Skip to content

Added customio for seq2seq models and updated input names #375

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kdulla
Copy link
Contributor

@kdulla kdulla commented Apr 22, 2025

added customio to seq2seq compile and updated input names to match other models

Signed-off-by: Kushal Dulla <quic_kdulla@quicinc.com>
@kdulla kdulla self-assigned this Apr 22, 2025
Signed-off-by: Kushal Dulla <quic_kdulla@quicinc.com>
@quic-amitraj
Copy link
Contributor

Apply lint and format @kdulla

@quic-rishinr
Copy link
Contributor

The format changes will go as part of #372. it can be rebased after that.

custom_io = {}

# Inputs
for output_name in output_names:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says inputs, but the line below is iterating output_names. We need to add input_features to custom_io.

Otherwise, input_features are still float32, as in the generation code input_features are explicitly converted to float32:
line 1905 inputs["input_features"] = inputs["input_features"].numpy().astype(np.float32) and line 1939 inputs["input_features"] = np.zeros((self.batch_size, self.model.config.num_mel_bins, 1)).astype(np.float32)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdulla Could you add input_features to custom_io and see if dtype conversion can be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are adding inputs to custom_io in this loop, we get the names of inputs by slicing "_RetainedState" off the end of output_names, this is just the most straightforward to get the input_names that will be compatible with future Seq2Seq models added.

input_features are in float32 because that is the output type of WhisperProcessor, the generate is written in a way that the processor inputs are taken directly as input, so we expect float32.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input_features are in float32 because that is the output type of WhisperProcessor, the generate is written in a way that the processor inputs are taken directly as input, so we expect float32.

However, for vision models, even though they use AutoProcessor which outputs pixel_values in float32, pixel_values is still part of the custom_io and is set to float16. : https://github.com/quic/efficient-transformers/pull/336/files Additionally, inside the generate function vision_inputs["pixel_values"] = vision_inputs["pixel_values"].astype("float16")

So I don't see any reason that seq2seq models can't do the same. It would be great if the design choices were more consistent, so that in vLLM we don't have to convert multimodal inputs to different data types for different models.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have updated seq2seq models to match vision models and use float16

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I have verified the PR in vLLM and it looks good to me.

kdulla added 3 commits April 24, 2025 08:48
Signed-off-by: Kushal Dulla <quic_kdulla@quicinc.com>
Signed-off-by: kdulla <quic_kdulla@quicinc.com>
Signed-off-by: Kushal Dulla <quic_kdulla@quicinc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants