[Misc] Auto download question file for benchmark/mtbench (#17019)
This commit is contained in:
@@ -9,6 +9,7 @@ from fastchat.model import get_conversation_template
|
||||
from tqdm import tqdm
|
||||
|
||||
from sglang.test.test_utils import add_common_other_args_and_parse, get_call_generate
|
||||
from sglang.utils import download_and_cache_file
|
||||
|
||||
|
||||
def load_questions(filename):
|
||||
@@ -37,7 +38,13 @@ def write_answers(filename, model_id, questions, answers):
|
||||
|
||||
|
||||
def main(args):
|
||||
questions = load_questions(args.question_file)
|
||||
# Download question file if not exist
|
||||
question_file = args.question_file
|
||||
url = "https://raw.githubusercontent.com/lm-sys/FastChat/main/fastchat/llm_judge/data/mt_bench/question.jsonl"
|
||||
if not os.path.isfile(question_file):
|
||||
question_file = download_and_cache_file(url)
|
||||
|
||||
questions = load_questions(question_file)
|
||||
questions = (questions * 10)[: args.num_questions]
|
||||
max_tokens = 256
|
||||
model_id = "llama-2-chat"
|
||||
|
||||
@@ -9,6 +9,7 @@ from sglang.test.test_utils import (
|
||||
add_common_sglang_args_and_parse,
|
||||
select_sglang_backend,
|
||||
)
|
||||
from sglang.utils import download_and_cache_file
|
||||
|
||||
|
||||
def load_questions(filename):
|
||||
@@ -46,8 +47,14 @@ def answer_mt_bench(s, question_1, question_2):
|
||||
|
||||
|
||||
def main(args):
|
||||
# Download question file if not exist
|
||||
question_file = args.question_file
|
||||
url = "https://raw.githubusercontent.com/lm-sys/FastChat/main/fastchat/llm_judge/data/mt_bench/question.jsonl"
|
||||
if not os.path.isfile(question_file):
|
||||
question_file = download_and_cache_file(url)
|
||||
|
||||
# Construct prompts
|
||||
questions = load_questions(args.question_file)[: args.num_questions]
|
||||
questions = load_questions(question_file)[: args.num_questions]
|
||||
arguments = [
|
||||
{"question_1": q["turns"][0], "question_2": q["turns"][1]} for q in questions
|
||||
]
|
||||
|
||||
@@ -18,6 +18,7 @@ from sglang.test.test_utils import (
|
||||
add_common_sglang_args_and_parse,
|
||||
select_sglang_backend,
|
||||
)
|
||||
from sglang.utils import download_and_cache_file
|
||||
|
||||
|
||||
def load_questions(filename):
|
||||
@@ -57,8 +58,14 @@ def answer_mt_bench(s, question_1, question_2):
|
||||
|
||||
|
||||
def main(args):
|
||||
# Download question file if not exist
|
||||
question_file = args.question_file
|
||||
url = "https://raw.githubusercontent.com/lm-sys/FastChat/main/fastchat/llm_judge/data/mt_bench/question.jsonl"
|
||||
if not os.path.isfile(question_file):
|
||||
question_file = download_and_cache_file(url)
|
||||
|
||||
# Construct prompts
|
||||
questions = load_questions(args.question_file)[: args.num_questions]
|
||||
questions = load_questions(question_file)[: args.num_questions]
|
||||
arguments = [
|
||||
{"question_1": q["turns"][0], "question_2": q["turns"][1]} for q in questions
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user