Skip to content

Commit

Permalink
Refactor get_context method in ContextSampler class
Browse files Browse the repository at this point in the history
  • Loading branch information
pufanyi committed Mar 30, 2024
1 parent b677bf3 commit a2e6e0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lmms_eval/api/samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __init__(self, docs: FewShotDataset, task, fewshot_indices=None, rnd=None) -
if fewshot_indices: # subset few-shot docs from
self.docs.fewshot_indices = fewshot_indices

def get_context(self, doc, num_fewshot, model_specific_prompt_kwargs=None):
def get_context(self, doc, num_fewshot):
# draw an extra fewshot sample if using same split as evaluating on
n_samples = num_fewshot + 1 if self.docs.same_as_eval else num_fewshot

Expand All @@ -123,7 +123,7 @@ def get_context(self, doc, num_fewshot, model_specific_prompt_kwargs=None):
labeled_examples = Context(self.task, self.fewshot_delimiter, self.target_delimiter)

for idx, doc in selected_docs:
labeled_examples.add_in_context_example(doc, model_specific_prompt_kwargs, self.docs, idx)
labeled_examples.add_in_context_example(doc, self.docs, idx)

return labeled_examples

Expand Down

0 comments on commit a2e6e0e

Please sign in to comment.