Commit e1d5c849 authored by lintangsutawika's avatar lintangsutawika
Browse files

moved squad.py and format changes

parent 8bf55a20
...@@ -208,7 +208,6 @@ class Task(abc.ABC): ...@@ -208,7 +208,6 @@ class Task(abc.ABC):
TaskConfig( TaskConfig(
{ {
**config, **config,
**{"dataset_path": DATASET_PATH, "dataset_name": DATASET_NAME},
} }
) )
if config if config
...@@ -217,7 +216,6 @@ class Task(abc.ABC): ...@@ -217,7 +216,6 @@ class Task(abc.ABC):
self._filters = [build_filter_ensemble("none", [["take_first", None]])] self._filters = [build_filter_ensemble("none", [["take_first", None]])]
def download(self, data_dir=None, cache_dir=None, download_mode=None) -> None: def download(self, data_dir=None, cache_dir=None, download_mode=None) -> None:
"""Downloads and returns the task dataset. """Downloads and returns the task dataset.
Override this method to download the dataset from a custom API. Override this method to download the dataset from a custom API.
...@@ -357,9 +355,7 @@ class Task(abc.ABC): ...@@ -357,9 +355,7 @@ class Task(abc.ABC):
False False
), f"Task dataset (path={self.DATASET_PATH}, name={self.DATASET_NAME}) must have valid or test docs!" ), f"Task dataset (path={self.DATASET_PATH}, name={self.DATASET_NAME}) must have valid or test docs!"
eval_logger.info( eval_logger.info(f"Building contexts for task on rank {rank}...")
f"Building contexts for task on rank {rank}..."
)
instances = [] instances = []
for doc_id, doc in utils.create_iterator( for doc_id, doc in utils.create_iterator(
...@@ -450,7 +446,12 @@ class Task(abc.ABC): ...@@ -450,7 +446,12 @@ class Task(abc.ABC):
@utils.positional_deprecated @utils.positional_deprecated
def fewshot_context( def fewshot_context(
self, doc, num_fewshot, provide_description=None, rnd=random.Random(1234), description=None self,
doc,
num_fewshot,
provide_description=None,
rnd=random.Random(1234),
description=None,
): ):
"""Returns a fewshot context string that is made up of a prepended description """Returns a fewshot context string that is made up of a prepended description
(if provided), the `num_fewshot` number of examples, and an appended prompt example. (if provided), the `num_fewshot` number of examples, and an appended prompt example.
...@@ -800,7 +801,6 @@ class ConfigurableTask(Task): ...@@ -800,7 +801,6 @@ class ConfigurableTask(Task):
) )
return super().fewshot_docs() return super().fewshot_docs()
@utils.positional_deprecated @utils.positional_deprecated
def fewshot_context(self, doc, num_fewshot): def fewshot_context(self, doc, num_fewshot):
"""Returns a fewshot context string that is made up of a prepended description """Returns a fewshot context string that is made up of a prepended description
...@@ -834,7 +834,6 @@ class ConfigurableTask(Task): ...@@ -834,7 +834,6 @@ class ConfigurableTask(Task):
else: else:
return labeled_examples + str(example) return labeled_examples + str(example)
def apply_filters(self): def apply_filters(self):
if hasattr(self, "_filters"): if hasattr(self, "_filters"):
for f in self._filters: for f in self._filters:
......
...@@ -15,7 +15,7 @@ from lm_eval.api.registry import ( ...@@ -15,7 +15,7 @@ from lm_eval.api.registry import (
import logging import logging
from .squad import SQuAD2 from .squadv2.squad import SQuAD2
eval_logger = logging.getLogger("lm-eval") eval_logger = logging.getLogger("lm-eval")
......
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