Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
Signed-off-by: Shanshan Wang <shanshan.wang@h2o.ai>
  • Loading branch information
cooleel committed Oct 28, 2024
1 parent c831f22 commit 2dfd320
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 100 deletions.
2 changes: 1 addition & 1 deletion examples/offline_inference_vision_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,4 +502,4 @@ def main(args):
default=16,
help='Number of frames to extract from the video.')
args = parser.parse_args()
main(args)
main(args)
3 changes: 2 additions & 1 deletion examples/offline_inference_vision_language_multi_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def load_phi3v(question: str, image_urls: List[str]) -> ModelRequestData:
chat_template=None,
)


def load_h2onvl(question: str, image_urls: List[str]) -> ModelRequestData:
model_name = "h2oai/h2ovl-mississippi-2b"

Expand Down Expand Up @@ -139,6 +140,7 @@ def load_h2onvl(question: str, image_urls: List[str]) -> ModelRequestData:
chat_template=None,
)


def load_internvl(question: str, image_urls: List[str]) -> ModelRequestData:
model_name = "OpenGVLab/InternVL2-2B"

Expand Down Expand Up @@ -318,7 +320,6 @@ def run_generate(model, question: str, image_urls: List[str]):
for o in outputs:
generated_text = o.outputs[0].text
print(generated_text)



def run_chat(model: str, question: str, image_urls: List[str]):
Expand Down
3 changes: 2 additions & 1 deletion vllm/entrypoints/chat_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ def _placeholder_str(self, modality: ModalityStr,
if model_type.startswith("llava"):
return self._cached_token_str(self._tokenizer,
hf_config.image_token_index)
if model_type in ("chameleon", "internvl_chat", "NVLM_D", "h2ovl_chat"):
if model_type in ("chameleon", "internvl_chat", "NVLM_D",
"h2ovl_chat"):
return "<image>"
if model_type == "mllama":
return "<|image|>"
Expand Down
Loading

0 comments on commit 2dfd320

Please sign in to comment.