[Model] Initialize support for InternVL2 series models (#6514)
Co-authored-by: Roger Wang <ywang@roblox.com>
This commit is contained in:
@ -106,6 +106,20 @@ def run_minicpmv(question):
|
||||
return llm, prompt
|
||||
|
||||
|
||||
# InternVL
|
||||
def run_internvl(question):
|
||||
# Generally, InternVL can use chatml template for conversation
|
||||
TEMPLATE = "<|im_start|>User\n{prompt}<|im_end|>\n<|im_start|>Assistant\n"
|
||||
prompt = f"<image>\n{question}\n"
|
||||
prompt = TEMPLATE.format(prompt=prompt)
|
||||
llm = LLM(
|
||||
model="OpenGVLab/InternVL2-4B",
|
||||
trust_remote_code=True,
|
||||
max_num_seqs=5,
|
||||
)
|
||||
return llm, prompt
|
||||
|
||||
|
||||
# BLIP-2
|
||||
def run_blip2(question):
|
||||
|
||||
@ -125,6 +139,7 @@ model_example_map = {
|
||||
"chameleon": run_chameleon,
|
||||
"minicpmv": run_minicpmv,
|
||||
"blip-2": run_blip2,
|
||||
"internvl_chat": run_internvl,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user