From d59e0cce5c4f4e3ed3a0e725a406bf3578f1ebf8 Mon Sep 17 00:00:00 2001 From: "Chen, Zhentao" Date: Tue, 9 Apr 2024 15:48:53 +0800 Subject: [PATCH] Migrate harness to ipexllm (#10703) * migrate to ipexlm * fix workflow * fix run_multi * fix precision map * rename ipexlm to ipexllm * rename bigdl to ipex in comments --- .github/workflows/llm-harness-evaluation.yml | 2 +- python/llm/dev/benchmark/harness/harness_to_leaderboard.py | 4 ++-- .../llm/dev/benchmark/harness/{bigdl_llm.py => ipexllm.py} | 2 +- python/llm/dev/benchmark/harness/run_llb.py | 4 ++-- python/llm/dev/benchmark/harness/run_multi_llb.py | 5 +++-- 5 files changed, 9 insertions(+), 8 deletions(-) rename python/llm/dev/benchmark/harness/{bigdl_llm.py => ipexllm.py} (98%) diff --git a/.github/workflows/llm-harness-evaluation.yml b/.github/workflows/llm-harness-evaluation.yml index 11255e03096..e940f245244 100644 --- a/.github/workflows/llm-harness-evaluation.yml +++ b/.github/workflows/llm-harness-evaluation.yml @@ -189,7 +189,7 @@ jobs: fi python run_llb.py \ - --model bigdl-llm \ + --model ipex-llm \ --pretrained ${MODEL_PATH} \ --precision ${{ matrix.precision }} \ --device ${{ matrix.device }} \ diff --git a/python/llm/dev/benchmark/harness/harness_to_leaderboard.py b/python/llm/dev/benchmark/harness/harness_to_leaderboard.py index 82cdc341862..5dd04b9a876 100644 --- a/python/llm/dev/benchmark/harness/harness_to_leaderboard.py +++ b/python/llm/dev/benchmark/harness/harness_to_leaderboard.py @@ -48,7 +48,7 @@ drop='f1' ) -def parse_precision(precision, model="bigdl-llm"): +def parse_precision(precision, model="ipex-llm"): result = match(r"([a-zA-Z_]+)(\d+)([a-zA-Z_\d]*)", precision) datatype = result.group(1) bit = int(result.group(2)) @@ -62,6 +62,6 @@ def parse_precision(precision, model="bigdl-llm"): else: if model == "hf-causal": return f"bnb_type={precision}" - if model == "bigdl-llm": + if model == "ipex-llm": return f"load_in_low_bit={precision}" raise RuntimeError(f"invald precision {precision}") diff --git a/python/llm/dev/benchmark/harness/bigdl_llm.py b/python/llm/dev/benchmark/harness/ipexllm.py similarity index 98% rename from python/llm/dev/benchmark/harness/bigdl_llm.py rename to python/llm/dev/benchmark/harness/ipexllm.py index 8626fc1a543..0049f1e476f 100644 --- a/python/llm/dev/benchmark/harness/bigdl_llm.py +++ b/python/llm/dev/benchmark/harness/ipexllm.py @@ -35,7 +35,7 @@ def _collate(x): utils.Reorderer = force_decrease_order(utils.Reorderer) -class BigDLLM(AutoCausalLM): +class IPEXLLM(AutoCausalLM): AUTO_MODEL_CLASS = AutoModelForCausalLM AutoCausalLM_ARGS = inspect.getfullargspec(AutoCausalLM.__init__).args def __init__(self, *args, **kwargs): diff --git a/python/llm/dev/benchmark/harness/run_llb.py b/python/llm/dev/benchmark/harness/run_llb.py index 3e8bd03a8e0..a3ab55b0dd2 100644 --- a/python/llm/dev/benchmark/harness/run_llb.py +++ b/python/llm/dev/benchmark/harness/run_llb.py @@ -20,8 +20,8 @@ from harness_to_leaderboard import * from lm_eval import tasks, evaluator, utils, models -from bigdl_llm import BigDLLM -models.MODEL_REGISTRY['bigdl-llm'] = BigDLLM # patch bigdl-llm to harness +from ipexllm import IPEXLLM +models.MODEL_REGISTRY['ipex-llm'] = IPEXLLM # patch ipex-llm to harness logging.getLogger("openai").setLevel(logging.WARNING) diff --git a/python/llm/dev/benchmark/harness/run_multi_llb.py b/python/llm/dev/benchmark/harness/run_multi_llb.py index 77596b6dd62..7f4b2df3321 100644 --- a/python/llm/dev/benchmark/harness/run_multi_llb.py +++ b/python/llm/dev/benchmark/harness/run_multi_llb.py @@ -22,8 +22,9 @@ from multiprocessing import Queue, Process import multiprocessing as mp from contextlib import redirect_stdout, redirect_stderr -from bigdl_llm import BigDLLM -models.MODEL_REGISTRY['bigdl-llm'] = BigDLLM # patch bigdl-llm to harness + +from ipexllm import IPEXLLM +models.MODEL_REGISTRY['ipex-llm'] = IPEXLLM # patch ipex-llm to harness logging.getLogger("openai").setLevel(logging.WARNING)