Commit 13a3f1d6 authored by Baber's avatar Baber
Browse files

better error handling

parent 7489a342
...@@ -33,6 +33,7 @@ class JudgeTask(ConfigurableTask): ...@@ -33,6 +33,7 @@ class JudgeTask(ConfigurableTask):
resps = [] resps = []
# load json # load json
if self.output_path is not None:
with open(self.output_path, "r") as f: with open(self.output_path, "r") as f:
for line in f: for line in f:
resp = json.loads(line) resp = json.loads(line)
......
...@@ -265,23 +265,18 @@ class TaskManager: ...@@ -265,23 +265,18 @@ class TaskManager:
), ),
**config, **config,
} }
if self._config_is_python_task(config):
if self._class_has_config_in_constructor(config["class"]):
task_object = config["class"](config=config)
else:
task_object = config["class"]()
if isinstance(task_object, ConfigurableTask):
# very scuffed: set task name here. TODO: fixme?
task_object.config.task = config["task"]
else:
try:
if "output_type" in config: if "output_type" in config:
task_object = JudgeTask( task_object = JudgeTask(
config=config, output_path=config.get("output_path") config=config, output_path=config.get("output_path", None)
) )
except Exception: # if self._config_is_python_task(config):
config.pop("output_type") # if self._class_has_config_in_constructor(config["class"]):
task_object = ConfigurableTask(config=config) # task_object = config["class"](config=config)
# else:
# task_object = config["class"]()
# if isinstance(task_object, ConfigurableTask):
# # very scuffed: set task name here. TODO: fixme?
# task_object.config.task = config["task"]
else: else:
task_object = ConfigurableTask(config=config) task_object = ConfigurableTask(config=config)
...@@ -502,7 +497,7 @@ class TaskManager: ...@@ -502,7 +497,7 @@ class TaskManager:
"`group` and `group_alias` keys in tasks' configs will no longer be used in the next release of lm-eval. " "`group` and `group_alias` keys in tasks' configs will no longer be used in the next release of lm-eval. "
"`tag` will be used to allow to call a collection of tasks just like `group`. " "`tag` will be used to allow to call a collection of tasks just like `group`. "
"`group` will be removed in order to not cause confusion with the new ConfigurableGroup " "`group` will be removed in order to not cause confusion with the new ConfigurableGroup "
"which will be the offical way to create groups with addition of group-wide configuations." "which will be the official way to create groups with addition of group-wide configurations."
) )
print_info = False print_info = False
# attr = "tag" # attr = "tag"
......
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