diff --git a/docs/models/supported_models.md b/docs/models/supported_models.md index dea60155ac02..f36f74308c88 100644 --- a/docs/models/supported_models.md +++ b/docs/models/supported_models.md @@ -707,7 +707,7 @@ These models primarily accept the [`LLM.generate`](./generative_models.md#llmgen | `GraniteSpeechForConditionalGeneration` | Granite Speech | T + A | `ibm-granite/granite-speech-3.3-8b` | ✅︎ | ✅︎ | | `HCXVisionForCausalLM` | HyperCLOVAX-SEED-Vision-Instruct-3B | T + I+ + V+ | `naver-hyperclovax/HyperCLOVAX-SEED-Vision-Instruct-3B` | | | | `HCXVisionV2ForCausalLM` | HyperCLOVAX-SEED-Think-32B | T + I+ + V+ | `naver-hyperclovax/HyperCLOVAX-SEED-Think-32B` | | | -| `H2OVLChatModel` | H2OVL | T + IE+ | `h2oai/h2ovl-mississippi-800m`, `h2oai/h2ovl-mississippi-2b`, etc. | | ✅︎ | +| `H2OVLChatModel` | H2OVL | T + IE+ | `h2oai/h2ovl-mississippi-800m`, `h2oai/h2ovl-mississippi-2b`, etc. | ✅︎ | ✅︎ | | `HunYuanVLForConditionalGeneration` | HunyuanOCR | T + IE+ | `tencent/HunyuanOCR`, etc. | ✅︎ | ✅︎ | | `Idefics3ForConditionalGeneration` | Idefics3 | T + I | `HuggingFaceM4/Idefics3-8B-Llama3`, etc. | ✅︎ | | | `IsaacForConditionalGeneration` | Isaac | T + I+ | `PerceptronAI/Isaac-0.1` | ✅︎ | ✅︎ | diff --git a/vllm/model_executor/models/h2ovl.py b/vllm/model_executor/models/h2ovl.py index 3b01985c4458..6526e218175e 100644 --- a/vllm/model_executor/models/h2ovl.py +++ b/vllm/model_executor/models/h2ovl.py @@ -163,3 +163,17 @@ def _init_vision_model( else: msg = "Monolith mode is not applicable to H2OVL" raise NotImplementedError(msg) + + def get_num_mm_encoder_tokens(self, num_image_tokens: int) -> int: + if num_image_tokens <= 0 or self.num_image_token <= 0: + return 0 + + num_patches = num_image_tokens // self.num_image_token + return num_patches * (self.patch_tokens + 1) + + def get_num_mm_connector_tokens(self, num_vision_tokens: int) -> int: + if num_vision_tokens <= 0 or self.num_image_token <= 0: + return 0 + + num_patches = num_vision_tokens // (self.patch_tokens + 1) + return num_patches * self.num_image_token