MCPcopy
hub / github.com/NVIDIA/TensorRT-LLM / format_example

Function format_example

examples/mmlu.py:157–165  ·  view source on GitHub ↗
(df, idx, include_answer=True)

Source from the content-addressed store, hash-verified

155
156
157def format_example(df, idx, include_answer=True):
158 prompt = df.iloc[idx, 0]
159 k = df.shape[1] - 2
160 for j in range(k):
161 prompt += "\n{}. {}".format(get_choices()[j], df.iloc[idx, j + 1])
162 prompt += "\nAnswer:"
163 if include_answer:
164 prompt += " {}\n\n".format(df.iloc[idx, k + 1])
165 return prompt
166
167
168def gen_prompt(train_df, subject, k=-1):

Callers 2

gen_promptFunction · 0.85
evaluateFunction · 0.85

Calls 1

get_choicesFunction · 0.85

Tested by

no test coverage detected