Commit 8310e67e authored by Chris's avatar Chris
Browse files

Fix formatting

parent ad4ab52a
......@@ -126,7 +126,7 @@ def get_metric(name, hf_evaluate_metric=False):
eval_logger.warning(
f"Could not find registered metric '{name}' in lm-eval, searching in HF Evaluate library..."
)
try:
metric_object = evaluate.load(name)
return metric_object.compute
......
......@@ -555,9 +555,13 @@ class ConfigurableTask(Task):
kwargs = {
key: metric_config[key]
for key in metric_config
if key not in ["metric", "aggregation", "higher_is_better", "hf_evaluate"]
if key
not in ["metric", "aggregation", "higher_is_better", "hf_evaluate"]
}
hf_evaluate_metric = "hf_evaluate" in metric_config and metric_config["hf_evaluate"] is True
hf_evaluate_metric = (
"hf_evaluate" in metric_config
and metric_config["hf_evaluate"] is True
)
if self.config.process_results is not None:
self._metric_fn_list[metric_name] = None
......@@ -568,7 +572,9 @@ class ConfigurableTask(Task):
self._metric_fn_list[metric_name] = metric_fn
self._metric_fn_kwargs[metric_name] = kwargs
else:
self._metric_fn_list[metric_name] = get_metric(metric_name, hf_evaluate_metric)
self._metric_fn_list[metric_name] = get_metric(
metric_name, hf_evaluate_metric
)
self._metric_fn_kwargs[metric_name] = kwargs
if "aggregation" in metric_config:
......
......@@ -37,7 +37,9 @@ class MapFilter(Filter):
Example:
mapper = MapFilter({'A': 1, 'B': 2}, default_value=0)
"""
assert isinstance(mapping_dict, dict), "Provided mapping_dict is not a dictionary"
assert isinstance(
mapping_dict, dict
), "Provided mapping_dict is not a dictionary"
self.mapping_dict = mapping_dict
self.default_value = default_value
......
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