-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
[Frontend] [Core] Integrate Tensorizer in to S3 loading machinery, allow passing arbitrary arguments during save/load #19619
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
[Frontend] [Core] Integrate Tensorizer in to S3 loading machinery, allow passing arbitrary arguments during save/load #19619
Conversation
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
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.
Summary of Changes
Hello @sangstar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the integration of Tensorizer within vLLM, particularly for S3-based workflows. It simplifies the loading process by allowing users to specify an S3 directory directly as the model path, while also making the serialization process more complete by including non-tensor model artifacts. Additionally, it provides greater flexibility by enabling the passing of arbitrary Tensorizer arguments during both serialization and deserialization.
Highlights
- Seamless S3 Loading: Tensorizer loading is now integrated with the
S3Model
machinery. Users can simply provide an S3 directory containing the tensorized model and other artifacts (like config, tokenizer files) as the model tag, and vLLM will automatically load it using Tensorizer, without needing the--model-loader-extra-config
flag for basic loading. - Comprehensive Serialization: When serializing a vLLM model with Tensorizer, the process now automatically includes all necessary model artifacts (config, tokenizer files, etc.) from the original Hugging Face model using
huggingface_hub.snapshot_download
, in addition to the model tensors. This ensures the serialized output is a complete package ready for deployment. - Arbitrary Tensorizer Args: The
--model-loader-extra-config
flag now supports passing arbitrary keyword arguments to Tensorizer'sTensorSerializer
andTensorDeserializer
via nestedserialization_kwargs
anddeserialization_kwargs
JSON objects. This allows fine-grained control over Tensorizer's behavior during save and load. - Tensorizer Version Update: The required Tensorizer version has been updated to
2.10.0
, which includes improvements like boto3-style credential support. - Improved Config Parsing: The regex used to parse the
--model-loader-extra-config
JSON string has been fixed to correctly handle newlines and leading/trailing whitespace.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request significantly enhances Tensorizer integration within vLLM. Key improvements include:
- Simplified S3 Loading: Models can now be loaded from S3 by specifying the directory containing all artifacts (including
model.tensors
,config.json
, tokenizer files, etc.). Tensorizer will automatically download necessary non-tensor files usinghuggingface_hub.snapshot_download
during serialization, making the loading process seamless. - Arbitrary Argument Passing: Users can now pass arbitrary keyword arguments to
TensorSerializer
andTensorDeserializer
during save and load operations viaserialization_kwargs
anddeserialization_kwargs
inTensorizerConfig
or through the example script. - Tensorizer Version Update: The
tensorizer
dependency is updated to2.10.0
, which includes boto3-style S3 credential support. - Improved CLI Argument Parsing: The regex for parsing JSON in CLI arguments now correctly handles newlines.
- Refactored Configuration:
TensorizerConfig
andTensorizerArgs
have been refactored for better clarity and flexibility.
The changes are well-tested, including new end-to-end tests for serialization and serving. The example script tensorize_vllm_model.py
has been updated to reflect these new capabilities.
One area for minor improvement could be updating the docstring of the example script to more prominently feature the new S3 directory loading mechanism.
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.
LGTM. Can we deprecate the previous model-load-extra field?
I think we ought to have a model-loader-config fwiw and maybe follow similar spec as speculative-config
cc @hmellor the config change
Made some small extra tweaks; fast check tests passing! |
Gentle pokes for visibility! Anything else I can address for y'all? @jeejeelee @aarnphm @ywang96 |
Gentle prod! Is there anything else I can assist with in getting this merged? @aarnphm @ywang96 @jeejeelee @DarkLight1337 |
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.
Ok, have a stamp from me. Tiny comment.
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
342d7ae
to
ab44e9d
Compare
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Signed-off-by: Sanger Steel <[email protected]>
Rebased. Looks like there was a few test failures unrelated to my changes. Anything else needs doing or can this be merged? @aarnphm @DarkLight1337 @jeejeelee @simon-mo @ywang96 @mgoin |
…low passing arbitrary arguments during save/load (vllm-project#19619) Signed-off-by: Sanger Steel <[email protected]> Co-authored-by: Eta <[email protected]>
…low passing arbitrary arguments during save/load (vllm-project#19619) Signed-off-by: Sanger Steel <[email protected]> Co-authored-by: Eta <[email protected]>
…low passing arbitrary arguments during save/load (vllm-project#19619) Signed-off-by: Sanger Steel <[email protected]> Co-authored-by: Eta <[email protected]> Signed-off-by: Patrick von Platen <[email protected]>
…low passing arbitrary arguments during save/load (vllm-project#19619) Signed-off-by: Sanger Steel <[email protected]> Co-authored-by: Eta <[email protected]>
…low passing arbitrary arguments during save/load (vllm-project#19619) Signed-off-by: Sanger Steel <[email protected]> Co-authored-by: Eta <[email protected]> Signed-off-by: avigny <[email protected]>
…low passing arbitrary arguments during save/load (vllm-project#19619) Signed-off-by: Sanger Steel <[email protected]> Co-authored-by: Eta <[email protected]>
Tensorizer and
S3Model
loading integrated, updatedtensorizer==2.10.1
, support passing allTensorSerializer
andTensorDeserializer
paramsSupersedes the closed #19616 with fixed signed-off commits.
This PR does the following:
Tensorizer
loading in to theS3Model
machinery. It now seamlessly can be used with it to load all non-tensor model artifacts.Tensorizer
now, when serializing, will not only serialize model tensors, but all model artifacts needed to run a model on vLLM, relying onhuggingface_hub
'ssnapshot_download
.--model-loader-extra-config
. Providing an S3 directory in the model tag will allow Tensorizer to resolve everything as long as all model artifacts forserved_model_name
are in the aforementioned directory, and Tensorizer can authenticate to S3 (which is does so with the usual boto3-style AWS environment variables, thes3cmd
-style environment variables, an~/.s3cfg
file, or the~/.aws/
config and credential files on one's home path. For example, after serializing a model with Tensorizer, this now works:--model-loader-extra
is still supported, and can accept additional nestedserialization_kwargs
anddeserialization_kwargs
JSONs, which allow configuringTensorDeserializer
andTensorSerializer
with arbitrary parameters (as long as they do not conflict with vLLM)tensorizer
version to==2.10.0
. This version comes with the boto3-style credential support.--model-loader-extra-config
to respect newlines.