Commit 691e0c0d authored by Konrad's avatar Konrad
Browse files

Adding a fewshot in a more readable way

parent 9bd948df
...@@ -61,8 +61,8 @@ class ContextSampler: ...@@ -61,8 +61,8 @@ class ContextSampler:
doc, doc,
num_fewshot, num_fewshot,
fewshot_as_multiturn: bool = False, fewshot_as_multiturn: bool = False,
chat_history: list = [],
): ):
chat_history = []
# draw an extra fewshot sample if using same split as evaluating on # draw an extra fewshot sample if using same split as evaluating on
n_samples = ( n_samples = (
num_fewshot + 1 num_fewshot + 1
......
...@@ -1043,8 +1043,10 @@ class ConfigurableTask(Task): ...@@ -1043,8 +1043,10 @@ class ConfigurableTask(Task):
# if few-shot - append examples after the system prompt # if few-shot - append examples after the system prompt
if num_fewshot > 0: if num_fewshot > 0:
if apply_chat_template: if apply_chat_template:
labeled_examples = self.sampler.get_chat_context( labeled_examples.extend(
doc, num_fewshot, fewshot_as_multiturn, labeled_examples self.sampler.get_chat_context(
doc, num_fewshot, fewshot_as_multiturn
)
) )
else: else:
labeled_examples += self.sampler.get_context(doc, num_fewshot) labeled_examples += self.sampler.get_context(doc, num_fewshot)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment