Skip to content

Commit

Permalink
feat: add llama3.2-11b-vision in all in one (#12207)
Browse files Browse the repository at this point in the history
* feat: add llama3.2-11b-vision in all in one

* fix: change model

* fix: change name

* fix: add a space

* fix: switch import
  • Loading branch information
cranechu0131 authored Oct 16, 2024
1 parent c9ac39f commit f17cc4f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions python/llm/dev/benchmark/all-in-one/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
'decapoda-research/llama-65b-hf','lmsys/vicuna-7b-v1.5',
'lmsys/vicuna-13b-v1.3','lmsys/vicuna-33b-v1.3','project-baize/merged-baize-30b']

LLAMA3_VISION_IDS = ['meta-llama/Llama-3.2-11B-Vision-Instruct']

CHATGLM_IDS = ['THUDM/chatglm-6b', 'THUDM/chatglm2-6b', 'THUDM/chatglm3-6b']

LLAVA_IDS = ['liuhaotian/llava-v1.5-7b']
Expand Down Expand Up @@ -770,6 +772,13 @@ def run_optimize_model_gpu(repo_id,
model = optimize_model(model, low_bit=low_bit)
tokenizer = LlamaTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = model.to('xpu')
elif repo_id in LLAMA3_VISION_IDS:
from transformers import MllamaForConditionalGeneration
model = MllamaForConditionalGeneration.from_pretrained(model_path, trust_remote_code=True,
low_cpu_mem_usage=True).eval()
model = optimize_model(model, low_bit=low_bit, modules_to_not_convert=["multi_modal_projector"])
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = model.to('xpu')
else:
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype='auto', low_cpu_mem_usage=True,
trust_remote_code=True, use_cache=True).eval()
Expand Down

0 comments on commit f17cc4f

Please sign in to comment.