Commit 3fe4b022 authored by Baber's avatar Baber
Browse files

fixup fewshots

parent 42478664
...@@ -675,9 +675,8 @@ class ConfigurableTask(Task): ...@@ -675,9 +675,8 @@ class ConfigurableTask(Task):
self.config.fewshot_cfg.num_fewshot() > 0 self.config.fewshot_cfg.num_fewshot() > 0
and self.fewshot_docs() is not None and self.fewshot_docs() is not None
): ):
self.fewshot_rnd = random.Random()
self.sampler = self.config.fewshot_cfg.init_sampler( self.sampler = self.config.fewshot_cfg.init_sampler(
list(self.fewshot_docs()), rnd=self.fewshot_rnd list(self.fewshot_docs()), self, rnd=self.fewshot_rnd
) )
self.task_docs = self.eval_docs self.task_docs = self.eval_docs
......
...@@ -114,15 +114,14 @@ class FewshotConfig: ...@@ -114,15 +114,14 @@ class FewshotConfig:
if rnd is None: if rnd is None:
raise ValueError( raise ValueError(
"A `random.Random` generator argument must be provided to `rnd` of FewShotSampler!" "A `random.Random` generator argument must be provided to `rnd` of FewShotSampler!"
) ) from None
return self.get_sampler( return self.get_sampler(
docs, docs,
task,
rnd=rnd, rnd=rnd,
fewshot_indices=fewshot_indices fewshot_indices=fewshot_indices
if fewshot_indices if fewshot_indices
else self.fewshot_indices, else self.fewshot_indices,
) ) # type: ignore
@dataclass @dataclass
...@@ -170,7 +169,8 @@ class TaskConfig: ...@@ -170,7 +169,8 @@ class TaskConfig:
should_decontaminate: bool = False should_decontaminate: bool = False
doc_to_decontamination_query: str | None = None doc_to_decontamination_query: str | None = None
gen_prefix: str | None = None gen_prefix: str | None = None
multiple_input: bool = False multiple_inputs: bool = False
multiple_targets: bool = False
metadata: dict = field( metadata: dict = field(
default_factory=dict default_factory=dict
) # by default, not used in the code. allows for users to pass arbitrary info to tasks ) # by default, not used in the code. allows for users to pass arbitrary info to tasks
......
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