Commit 10cc0a56 authored by lintangsutawika's avatar lintangsutawika
Browse files

edits and format

parent cfbad4c4
# from .evaluator import evaluate, simple_evaluate from .evaluator import evaluate, simple_evaluate
# from .logger import eval_logger, SPACING
...@@ -13,6 +13,7 @@ from lm_eval import evaluator, utils ...@@ -13,6 +13,7 @@ from lm_eval import evaluator, utils
from lm_eval.tasks import initialize_tasks, include_path from lm_eval.tasks import initialize_tasks, include_path
from lm_eval.api.registry import ALL_TASKS from lm_eval.api.registry import ALL_TASKS
def _handle_non_serializable(o): def _handle_non_serializable(o):
if isinstance(o, np.int64) or isinstance(o, np.int32): if isinstance(o, np.int64) or isinstance(o, np.int32):
return int(o) return int(o)
...@@ -163,7 +164,7 @@ def cli_evaluate(args: Union[argparse.Namespace, None] = None) -> None: ...@@ -163,7 +164,7 @@ def cli_evaluate(args: Union[argparse.Namespace, None] = None) -> None:
missing = ", ".join(task_missing) missing = ", ".join(task_missing)
eval_logger.error( eval_logger.error(
f"Tasks were not found: {missing}\n" f"Tasks were not found: {missing}\n"
f"{' ' * 47}Try `lm-eval --tasks list` for list of available tasks", f"{utils.SPACING}Try `lm-eval --tasks list` for list of available tasks",
) )
raise ValueError( raise ValueError(
f"Tasks {missing} were not found. Try `lm-eval --tasks list` for list of available tasks." f"Tasks {missing} were not found. Try `lm-eval --tasks list` for list of available tasks."
......
...@@ -20,7 +20,7 @@ from lm_eval.utils import ( ...@@ -20,7 +20,7 @@ from lm_eval.utils import (
make_table, make_table,
create_iterator, create_iterator,
get_git_commit_hash, get_git_commit_hash,
eval_logger eval_logger,
) )
...@@ -40,7 +40,6 @@ def simple_evaluate( ...@@ -40,7 +40,6 @@ def simple_evaluate(
decontamination_ngrams_path=None, decontamination_ngrams_path=None,
write_out: bool = False, write_out: bool = False,
log_samples: bool = True, log_samples: bool = True,
verbosity: str = "INFO",
): ):
"""Instantiate and evaluate a model on a list of tasks. """Instantiate and evaluate a model on a list of tasks.
......
...@@ -7,6 +7,7 @@ from typing import List, Any, Tuple ...@@ -7,6 +7,7 @@ from typing import List, Any, Tuple
eval_logger = utils.eval_logger eval_logger = utils.eval_logger
def anthropic_completion( def anthropic_completion(
client, #: anthropic.Anthropic, client, #: anthropic.Anthropic,
model: str, model: str,
......
...@@ -26,6 +26,7 @@ from typing import List, Optional, Union ...@@ -26,6 +26,7 @@ from typing import List, Optional, Union
eval_logger = utils.eval_logger eval_logger = utils.eval_logger
def _get_accelerate_args( def _get_accelerate_args(
device_map_option: Optional[str] = "auto", device_map_option: Optional[str] = "auto",
max_memory_per_gpu: Optional[Union[int, str]] = None, max_memory_per_gpu: Optional[Union[int, str]] = None,
......
...@@ -14,6 +14,7 @@ from lm_eval.api.registry import ( ...@@ -14,6 +14,7 @@ from lm_eval.api.registry import (
) )
import logging import logging
eval_logger = utils.eval_logger eval_logger = utils.eval_logger
......
...@@ -30,6 +30,7 @@ eval_logger = logging.getLogger("lm-eval") ...@@ -30,6 +30,7 @@ eval_logger = logging.getLogger("lm-eval")
SPACING = " " * 47 SPACING = " " * 47
def escaped_split(text, sep_char, maxsplit=-1): def escaped_split(text, sep_char, maxsplit=-1):
"""Split text into a list on occurrences of the given separation """Split text into a list on occurrences of the given separation
character `sep_char`. The separation character may be escaped by a character `sep_char`. The separation character may be escaped by a
......
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