Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add runable script for autoround #225

Merged
merged 24 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions auto_round/__eval__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import argparse

def eval():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_path", help="Path of the model to evaluate, oly support auto_round format."
)

parser.add_argument("--device", default="auto", type=str,
help="The device to be used for tuning. The default is set to auto/None,"
"allowing for automatic detection. Currently, device settings support CPU, GPU, and HPU.")

parser.add_argument("--tasks",
default="lambada_openai,hellaswag,winogrande,piqa,mmlu,wikitext,truthfulqa_mc1," \
"truthfulqa_mc2,openbookqa,boolq,rte,arc_easy,arc_challenge",
help="lm-eval tasks for lm_eval")

parser.add_argument("--eval_bs", default=4, type=int,
n1ck-guo marked this conversation as resolved.
Show resolved Hide resolved
help="eval batch size")

parser.add_argument("--disable_trust_remote_code", action='store_true',
help="Whether to disable trust_remote_code")

args = parser.parse_args()
from auto_round.eval.evaluation import simple_evaluate
model_args = model_args + f",trust_remote_code={not args.disable_trust_remote_code}"
n1ck-guo marked this conversation as resolved.
Show resolved Hide resolved
if isinstance(args.tasks, str):
tasks = args.tasks.split(',')
res = simple_evaluate(
model="hf",
model_args=model_args,
tasks=tasks,
device=args.device,
batch_size=args.eval_bs)

from lm_eval.utils import make_table # pylint: disable=E0401

print(make_table(res))
n1ck-guo marked this conversation as resolved.
Show resolved Hide resolved


if __name__ == '__main__':
eval()
Loading