Skip to content

Commit

Permalink
Update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
OyvindTafjord committed Sep 22, 2023
1 parent ef0d437 commit 2285ef2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eval/mmlu/run_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def eval_hf_model(args, subject, model, tokenizer, dev_df, test_df, batch_size=1
prompts.append(prompt)

# get the answer for all examples
# note: here we cannot directly use convert_tokens_to_ids because the some tokenizers will automatically add space prefix.
# adding a prefix space here, as that's expected from the prompt, should raise a warning if this returns more than one token
# adding a prefix space here, as that's expected from the prompt
# TODO: should raise a warning if this returns more than one token
answer_choice_ids = [tokenizer.encode(" " + answer_choice, add_special_tokens=False)[-1] for answer_choice in choices]
pred_indices, all_probs = get_next_word_predictions(
model, tokenizer, prompts, candidate_token_ids=answer_choice_ids, return_token_predictions=False, batch_size=batch_size
Expand Down

0 comments on commit 2285ef2

Please sign in to comment.