[Model] Add GLM-4v support and meet vllm==0.6.2 (#9242)

This commit is contained in:
sixgod
2024-10-11 17:36:13 +00:00
committed by GitHub
parent f710090d8e
commit 6cf1167c1a
7 changed files with 776 additions and 72 deletions
@@ -300,6 +300,21 @@ def run_mllama(question: str, modality: str):
return llm, prompt, stop_token_ids
# GLM-4v
def run_glm4v(question: str, modality: str):
assert modality == "image"
model_name = "THUDM/glm-4v-9b"
llm = LLM(model=model_name,
max_model_len=2048,
max_num_seqs=2,
trust_remote_code=True,
enforce_eager=True)
prompt = question
stop_token_ids = [151329, 151336, 151338]
return llm, prompt, stop_token_ids
model_example_map = {
"llava": run_llava,
"llava-next": run_llava_next,
@@ -316,6 +331,7 @@ model_example_map = {
"qwen_vl": run_qwen_vl,
"qwen2_vl": run_qwen2_vl,
"mllama": run_mllama,
"glm4v": run_glm4v,
}