MCPcopy Create free account
hub / github.com/Alpha-VLLM/LLaMA2-Accessory / format_example

Function format_example

light-eval/src/eval_mmlu.py:63–71  ·  view source on GitHub ↗
(df, idx, include_answer=True)

Source from the content-addressed store, hash-verified

61 return s
62
63def format_example(df, idx, include_answer=True):
64 prompt = df.iloc[idx, 0]
65 k = df.shape[1] - 2
66 for j in range(k):
67 prompt += "\n{}. {}".format(choices[j], df.iloc[idx, j+1])
68 prompt += "\nAnswer:"
69 if include_answer:
70 prompt += " {}\n\n".format(df.iloc[idx, k + 1])
71 return prompt
72
73def generate_few_shot_prompt(train_df, subject, k=-1):
74 prompt = "The following are multiple choice questions (with answers) about {}.\n\n".format(format_subject(subject))

Callers 2

generate_few_shot_promptFunction · 0.70
run_inferFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected