MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / format_example

Method format_example

tensorrt_llm/evaluate/mmlu.py:170–178  ·  view source on GitHub ↗
(self, df, idx, include_answer=True)

Source from the content-addressed store, hash-verified

168 return s
169
170 def format_example(self, df, idx, include_answer=True):
171 prompt = df.iloc[idx, 0]
172 k = df.shape[1] - 2
173 for j in range(k):
174 prompt += "\n{}. {}".format(self.CHOICES[j], df.iloc[idx, j + 1])
175 prompt += "\nAnswer:"
176 if include_answer:
177 prompt += " {}\n\n".format(df.iloc[idx, k + 1])
178 return prompt
179
180 def gen_prompt(self, train_df, subject, k=-1):
181 prompt = "The following are multiple choice questions (with answers) about {}.\n\n".format(

Callers 2

gen_promptMethod · 0.95
generate_samplesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected