-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[Frontend] Use engine argument to control MM cache size #22441
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 all commits
Commits
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
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
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
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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -358,8 +358,8 @@ class EngineArgs: | |||||
| "media_io_kwargs") | ||||||
| mm_processor_kwargs: Optional[Dict[str, Any]] = \ | ||||||
| MultiModalConfig.mm_processor_kwargs | ||||||
| disable_mm_preprocessor_cache: bool = \ | ||||||
| MultiModalConfig.disable_mm_preprocessor_cache | ||||||
| disable_mm_preprocessor_cache: bool = False # DEPRECATED | ||||||
| mm_processor_cache_gb: int = MultiModalConfig.mm_processor_cache_gb | ||||||
| # LoRA fields | ||||||
| enable_lora: bool = False | ||||||
| enable_lora_bias: bool = LoRAConfig.bias_enabled | ||||||
|
|
@@ -720,8 +720,11 @@ def add_cli_args(parser: FlexibleArgumentParser) -> FlexibleArgumentParser: | |||||
| "--mm-processor-kwargs", | ||||||
| **multimodal_kwargs["mm_processor_kwargs"]) | ||||||
| multimodal_group.add_argument( | ||||||
| "--disable-mm-preprocessor-cache", | ||||||
| **multimodal_kwargs["disable_mm_preprocessor_cache"]) | ||||||
| "--mm-processor-cache-gb", | ||||||
| **multimodal_kwargs["mm_processor_cache_gb"]) | ||||||
| multimodal_group.add_argument("--disable-mm-preprocessor-cache", | ||||||
| type=bool, | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This way it will default to
Suggested change
|
||||||
| deprecated=True) | ||||||
| multimodal_group.add_argument( | ||||||
| "--interleave-mm-strings", | ||||||
| **multimodal_kwargs["interleave_mm_strings"]) | ||||||
|
|
@@ -886,6 +889,23 @@ def create_model_config(self) -> ModelConfig: | |||||
| self.model = f"{MODEL_WEIGHTS_S3_BUCKET}/{self.model}" | ||||||
| self.load_format = "runai_streamer" | ||||||
|
|
||||||
| if self.disable_mm_preprocessor_cache: | ||||||
| logger.warning( | ||||||
| "`--disable-mm-preprocessor-cache` is deprecated " | ||||||
| "and will be removed in v0.13. " | ||||||
| "Please use `--mm-processor-cache-gb 0` instead.", ) | ||||||
|
|
||||||
| self.mm_processor_cache_gb = 0 | ||||||
| elif envs.VLLM_MM_INPUT_CACHE_GIB != 4: | ||||||
| logger.warning( | ||||||
| "VLLM_MM_INPUT_CACHE_GIB` is deprecated " | ||||||
| "and will be removed in v0.13. " | ||||||
| "Please use `--mm-processor-cache-gb %d` instead.", | ||||||
| envs.VLLM_MM_INPUT_CACHE_GIB, | ||||||
| ) | ||||||
|
|
||||||
| self.mm_processor_cache_gb = envs.VLLM_MM_INPUT_CACHE_GIB | ||||||
|
|
||||||
| return ModelConfig( | ||||||
| model=self.model, | ||||||
| hf_config_path=self.hf_config_path, | ||||||
|
|
@@ -922,7 +942,7 @@ def create_model_config(self) -> ModelConfig: | |||||
| use_async_output_proc=not self.disable_async_output_proc, | ||||||
| config_format=self.config_format, | ||||||
| mm_processor_kwargs=self.mm_processor_kwargs, | ||||||
| disable_mm_preprocessor_cache=self.disable_mm_preprocessor_cache, | ||||||
| mm_processor_cache_gb=self.mm_processor_cache_gb, | ||||||
| override_neuron_config=self.override_neuron_config, | ||||||
| override_pooler_config=self.override_pooler_config, | ||||||
| logits_processor_pattern=self.logits_processor_pattern, | ||||||
|
|
@@ -1234,13 +1254,13 @@ def create_engine_config( | |||||
| dp_supports_mm_processor_cache = (self.data_parallel_size == 1 | ||||||
| or data_parallel_external_lb) | ||||||
| if (not dp_supports_mm_processor_cache | ||||||
| and not model_config.disable_mm_preprocessor_cache): | ||||||
| and model_config.mm_processor_cache_gb > 0): | ||||||
| logger.warning( | ||||||
| "Multi-modal processor cache is disabled because " | ||||||
| "it is not compatible with data parallelism when " | ||||||
| "there does not exist a one-to-one correspondance " | ||||||
| "between API and engine core processes.") | ||||||
| model_config.set_disable_mm_preprocessor_cache(True) | ||||||
| model_config.set_mm_processor_cache_gb(0) | ||||||
|
|
||||||
| speculative_config = self.create_speculative_config( | ||||||
| target_model_config=model_config, | ||||||
|
|
||||||
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
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
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.
Would it be possible to deduplicate this config so it doesn't have to live in
ModelConfigandMultiModalConfigin the same way thatdisable_mm_preprocessor_cachedid?Uh oh!
There was an error while loading. Please reload this page.
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.
Which config are you referring to here? Since disable-mm-preprocessor-cache will be removed anyway, no point in refactoring that
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.
mm_processor_cache_gbis a field of bothModelConfigandMultiModalConfig.Can it just be a field of
MultiModalConfigand anywhere we havemodel_config.mm_processor_cache_gbchanges tomodel_config.multimodal_config.mm_processor_cache_gb?Uh oh!
There was an error while loading. Please reload this page.
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.
We currently initialize MultiModalConfig inside ModelConfig, so ModelConfig needs to accept all of the arguments that are forwarded to MultiModalConfig
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.
We should use https://docs.python.org/3/library/dataclasses.html#dataclasses.InitVar so that
mm_processor_cache_gbcan be accessed in__post_init__without making it afieldofModelConfigUh oh!
There was an error while loading. Please reload this page.
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.
Hmm let's do this in a separate PR since it would also apply to other fields of
MultiModalConfigThere 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.
good idea