Skip to content
Merged
Changes from all 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
11 changes: 11 additions & 0 deletions fastchat/llm_judge/gen_model_answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def run_eval(
num_gpus_total,
max_gpu_memory,
dtype,
revision,
):
questions = load_questions(question_file, question_begin, question_end)
# random shuffle the questions to balance the loading
Expand Down Expand Up @@ -61,6 +62,7 @@ def run_eval(
num_gpus_per_model,
max_gpu_memory,
dtype=dtype,
revision=revision,
)
)

Expand All @@ -79,9 +81,11 @@ def get_model_answers(
num_gpus_per_model,
max_gpu_memory,
dtype,
revision,
):
model, tokenizer = load_model(
model_path,
revision=revision,
device="cuda",
num_gpus=num_gpus_per_model,
max_gpu_memory=max_gpu_memory,
Expand Down Expand Up @@ -259,6 +263,12 @@ def reorg_answer_file(answer_file):
help="Override the default dtype. If not set, it will use float16 on GPU and float32 on CPU.",
default=None,
)
parser.add_argument(
"--revision",
type=str,
default="main",
help="The model revision to load.",
)

args = parser.parse_args()

Expand Down Expand Up @@ -288,6 +298,7 @@ def reorg_answer_file(answer_file):
num_gpus_total=args.num_gpus_total,
max_gpu_memory=args.max_gpu_memory,
dtype=str_to_torch_dtype(args.dtype),
revision=args.revision,
)

reorg_answer_file(answer_file)