97 Commits
Author SHA1 Message Date
Tai An d1193e39a2 fix(scripts): repair requests_caching.py entrypoint (bad kwargs + helper defined after use) (#4059)
The `__main__` block passed `model=` and `device=` to
`run_model_for_task_caching()`, whose signature is
`(tasks, cache_requests)` -- both are read from module constants inside
the function, so the call raised
`TypeError: run_model_for_task_caching() got an unexpected keyword
argument 'model'` before anything ran.

With that fixed the script then failed with
`NameError: name 'request_caching_arg_to_dict' is not defined`,
because that helper was defined *below* the `__main__` block and so was
not yet bound when the block executed.

Drop the two extra keyword arguments and move the helper above the
`__main__` block, next to its only caller.
2026-08-29 00:35:12 +05:00
Baber Abbasi b67284a75c chore: clean up deps; fix linting errors(#3748) 2026-05-05 00:38:52 +05:00
Chessing234 f0ba463c30 Fix zeno_visualize tasks intersection result being discarded (#3739) 2026-05-03 19:55:42 +05:00
595948946e fix(model_comparator): fix ImportError from scipy.stats.norm import (#3742)
* fix(model_comparator): import norm from scipy.stats, not scipy.stats.norm

* pacify pre-commit

---------

Co-authored-by: Chessing234 <[email protected]>
Co-authored-by: Baber Abbasi <[email protected]>
2026-05-03 19:54:42 +05:00
Baber Abbasi 2a5c0f041c refactor(Taskmanager)! (#3549)
- Refactors TaskManager into four modules: TaskManager (public API), TaskIndex (YAML discovery), TaskFactory (object construction), and _yaml_loader (YAML parsing).
- Replaces ConfigurableGroup with Group dataclass that holds direct child references and handles metric aggregation via Group.aggregate().
2026-02-14 02:32:45 +05:00
Baber Abbasi 59b3ba263b move torch/hf utils to utils_hf.py (#3450) 2025-12-09 13:45:40 +05:00
Debjyoti RayandBaber 0e96cd181a Fixed #3005: Processes both formats of model_args: string and dictionay (#3097)
* git push --force
correctly processes both formats of model_args: string and dictionary both

* exctract to function for better test

* nit

---------

Co-authored-by: Baber <[email protected]>
2025-07-05 22:07:13 +05:00
Stella Biderman 86c266a1b3 Delete scripts/cost_estimate.py (#2985)
This function was written years ago when the cost of running an OpenAI model was easy to compute. It is no longer viable to support this.
2025-05-18 02:54:43 +05:00
Kiersten Stokes 7158f4f4ab Add Markdown linter (#2818)
* Add markdown linter to pre-commit hooks

* Reformat existing markdown (excluding lm_eval/tasks/*.md)
2025-03-20 06:23:27 +05:00
Lintang SutawikaandBaber 1ba35e623b Logging (#2203)
* changed source of eval_logger

* allow eval_logger to be set from args

* removed verbosity arg from non-main methods

* fix logging

* pre-commit

* set verbosity in eval logger

* replace utils.eval_logger

* fix logging in main

* add logging to docs

* add logging message

* nit

* add logging to docs

* refactor setup_logging to utils

---------

Co-authored-by: Baber <[email protected]>
2025-02-21 06:23:59 +05:00
Baber Abbasi f724be699e update pre-commit (#2632)
* update pre-commit
2025-01-19 06:08:55 +05:00
Petr BaudisandBaber 6d62a69cb5 Fix Zeno visualizer on tasks like GSM8k (#2599)
* fix(zeno): Generate unique ids in case of multiple filters

* fix(zeno): Report even non-aggregable metrics, just not as metrics

* pre-commit

---------

Co-authored-by: Baber <[email protected]>
2025-01-07 19:01:15 +05:00
Leonid Sinev d4ae963510 [Fix] Replace generic exception classes with a more specific ones (#1989)
* Replace generic exception classes with a more specific ones

* rerun pre-commit to pass linter tests

* Revert "rerun pre-commit to pass linter tests"

This reverts commit 67f88ccf14.

* reduce repetitions in errors or so

* Replace generic exception class with a more specific one
2024-10-22 21:13:46 +05:00
Baber Abbasi 72d619ffdb fix writeout script (#2350) 2024-09-26 09:36:02 -04:00
Nam D. TranandBaber Abbasi b536f06762 Fix Zeno Visualizer (#2227)
* fix: arguments data

* fix based on comment

* Update zeno_visualize.py

updated all output types

---------

Co-authored-by: Baber Abbasi <[email protected]>
2024-08-20 21:29:55 +05:00
Nathan Weinberg 7f15cce4d7 refactor: limit usage of scipy and skilearn dependencies (#2097)
* refactor: move scipy and sklearn module imports to func imports

Signed-off-by: Nathan Weinberg <[email protected]>

* refactor: consolidate weighted_f1_score func into lm_eval utils

Signed-off-by: Nathan Weinberg <[email protected]>

* lint: allow for utils file to have unused imports

this allows for shared functions to be defined only
once while allowing for the YAML function importing
to continue working

Signed-off-by: Nathan Weinberg <[email protected]>

---------

Signed-off-by: Nathan Weinberg <[email protected]>
2024-08-01 12:19:07 -04:00
Hailey Schoelkopfandlintangsutawika ed72238f2c make write_out.py explicitly error if no splits match (#1796)
Co-authored-by: lintangsutawika <[email protected]>
2024-06-13 17:10:03 +07:00
Baber AbbasiandLintang Sutawika 3850e21acd samples is newline delimited (#1930)
* `samples` is newline delimited

* updated git and pre-commit

* appease pre-commit

* nit

* Revert back for now

* Revert for now

---------

Co-authored-by: Lintang Sutawika <[email protected]>
2024-06-13 16:54:06 +07:00
KonradSzafer 6995258180 Results filenames handling fix (#1926)
* results filenames handling moved to utils

* zeno results handling fix

* tasks_for_model backward compatibility

* results files logic moved to tasks_for_model

* moved sanitize_model_name to utils
2024-06-11 20:54:22 +07:00
e9a4054319 correction bug EleutherAI#1664 (#1670)
* correction bug EleutherAI#1664

* add any invalid characters for Windows filenames and Unix-like systems

see:
https://gist.github.com/doctaphred/d01d05291546186941e1b7ddc02034d3?permalink_comment_id=3958715

* Update lm_eval/__main__.py

* Update scripts/zeno_visualize.py

* fix format

---------

Co-authored-by: Hailey Schoelkopf <[email protected]>
Co-authored-by: haileyschoelkopf <[email protected]>
2024-04-07 10:12:32 -04:00
LSinevandHailey Schoelkopf 4ee1b386e9 Cleanup and fixes (Task, Instance, and a little bit of *evaluate) (#1533)
* Remove unused `decontamination_ngrams_path` and all mentions (still no alternative path provided)

* Fix improper import of LM and usage of evaluator in one of scripts

* update type hints in instance and task api

* raising errors in task.py instead of asserts

* Fix warnings from ruff

* raising errors in __main__.py instead of asserts

* raising errors in tasks/__init__.py instead of asserts

* raising errors in evaluator.py instead of asserts

* evaluator: update type hints and remove unused variables in code

* Update lm_eval/__main__.py

Co-authored-by: Hailey Schoelkopf <[email protected]>

* Update lm_eval/__main__.py

Co-authored-by: Hailey Schoelkopf <[email protected]>

* Update lm_eval/api/task.py

Co-authored-by: Hailey Schoelkopf <[email protected]>

* Update lm_eval/api/task.py

Co-authored-by: Hailey Schoelkopf <[email protected]>

* Update lm_eval/api/task.py

Co-authored-by: Hailey Schoelkopf <[email protected]>

* Update lm_eval/evaluator.py

Co-authored-by: Hailey Schoelkopf <[email protected]>

* pre-commit induced fixes

---------

Co-authored-by: Hailey Schoelkopf <[email protected]>
2024-03-06 13:09:33 -05:00
Baber Abbasi e5e35fca08 Vllm update DP+TP (#1508)
* use `@ray.remote` with distributed vLLM

* update versions

* bugfix

* unpin vllm

* fix pre-commit

* added version assertion error

* Revert "added version assertion error"

This reverts commit 8041e9b78e.

* added version assertion for DP

* expand DP note

* add warning

* nit

* pin vllm

* fix typos
2024-03-03 07:35:22 -05:00
Aaron VandHailey Schoelkopf 1e6c9272f2 Create a means for caching task registration and request building. Ad… (#1372)
* Create a means for caching task registration and request building. Add the ability to specify an args dict for simple_evaluate().

* Remove extra S in cache path in caching module

Co-authored-by: Hailey Schoelkopf <[email protected]>

* Rename requests cache args, make model_args polymorphic so that a dict can also be accepted.

* Update docs to reflect new caching behavior, add CLI args for requests caching. Create a function for deleting items in the cache.

* Update documentation, fix minor bug with arg parsing for requests caching where an undefined variable was used.

* Remove line from gitignore, add to cli for caching datasets.

* Add hashing suffix to .pickles. Update test script typo.

* Favor isinstance() over type() in evaluator.py

* Add tests for caching, gets tests working, remove unneeded arg from build_all_requests().

* Update arg description to simple_evaluate.

* Update pyproject.toml

* Fix typehint

* Remove the use of random() for creating default cache pickle hash.

* Check that cache dir exists before clearing it in request cache tests.

* Fix linting problems.

* Fix additional formatting errors.

* Remove trailing whitespace.

* Add new line to the end of .gitignore.

---------

Co-authored-by: Hailey Schoelkopf <[email protected]>
2024-02-26 09:54:52 -05:00
Baber Abbasi 2d0a646020 Refactor utilities into a separate model utils file. (#1429) 2024-02-14 13:21:03 -05:00
Michael Chen 4d7d2f6457 Update README.md (#1398)
Add instructions for non-MacOS users on how to compile janitor_util.cpp so that janitor.py can use it.
2024-02-05 21:00:21 -05:00
Lintang SutawikaandHailey Schoelkopf d714fc951b Faster Task and Group Loading, Allow Recursive Groups (#1321)
* add trust_remote_code as default

* task for testing recursive

* changed source of ALL_TASKS

* tasks should only accept TaskObjects

* initialize_tasks returns list of tasks and groups

* remove trust_remote_code for now

* moved constructor process to inside load_yaml_config

* more comprehensive way to index tasks and groups

* pre-commit format

* add exit after error

* adjust how task objects are called

* no need to use get_task_dict

* load_task_or_group works but only for tasks

* pre-commit format

* half working for nested groups

* changed variable names

* allow groups and tasks to work

* temp save

* indexing and loading are part of a task_manager object

* adapted initialize_tasks

* iron out bugs

* fixed typo

* fixed typo

* simplified code

* further tidy up

* remove lines for testing

* removed test lines

* removed unused code

* remove unused import

* fixed bug

* removed comments

* group in a list of group can accept parameter changes like `num_fewshot`

* add trust_remote_code as default

* task for testing recursive

* changed source of ALL_TASKS

* tasks should only accept TaskObjects

* initialize_tasks returns list of tasks and groups

* remove trust_remote_code for now

* moved constructor process to inside load_yaml_config

* more comprehensive way to index tasks and groups

* pre-commit format

* add exit after error

* adjust how task objects are called

* no need to use get_task_dict

* load_task_or_group works but only for tasks

* pre-commit format

* half working for nested groups

* changed variable names

* allow groups and tasks to work

* temp save

* indexing and loading are part of a task_manager object

* adapted initialize_tasks

* iron out bugs

* fixed typo

* fixed typo

* simplified code

* further tidy up

* remove lines for testing

* removed test lines

* removed unused code

* remove unused import

* fixed bug

* removed comments

* group in a list of group can accept parameter changes like `num_fewshot`

* check if config is task update

* add GroupConfig object

* edit test yaml

* remove args

* testing returning to python task list

* add weight_by_size config

* describe weight_by_size in docs

* fix weight by size potential error

* can load individual custom python class task

* moved import_function into the config loading file

* remove print lines

* add squadv2 yaml

* temporary scroll implementation

* revert back to use load_yaml_config but with modes

* fix group being loaded with a None

* reformat

* can load unregistered tasks from a group

* update scrolls

* edit scrolls multiplechoice task

* adjust class initialization

* fix initialization

* changed how to identify group and python tasks, fix logger

* allow loading "include" that is nested in a group config

* reworked flan benchmark

* allow duplicate task in the same group to co-exist

* process group_alias

* removed group_alias

* allow parameters set in group_config to apply to all tasks in tasklist

* add function, but comment for now

* reworked processing dict-base config

* fixed how configs in group are processed

* update to allow root group to have its alias used

* remove unused classes

* remove unused classes

* revert some parts to original

* forgot to change one variable

* adapt the new process to use get_task_dict

* fix for singular group call

* fix variable names

* add TaskManager into the evaluator

* format

* changed how dict tasks are loaded

* add docs

* Update docs/new_task_guide.md

Co-authored-by: Hailey Schoelkopf <[email protected]>

* Update evaluator.py

* Update evaluator.py

* remove groupconfig for now

* changed _config to config

* update interface.md to explain TaskManager

* added property functions

* adjusted logger

* update write_out.py

* updated tests

* added documentation and some modifications

* added docstring documentation

* precommit format

* updated task loading for tests

* updates tests

* changed arg order for load_yaml_config

* update to handle scrolls and edit log message

* remove unused lines

* return a list of task classes and not a dict

* Update __init__.py

* Delete lm_eval/tasks/benchmarks/test.yaml

* Update task.py

* Update lm_eval/utils.py

Co-authored-by: Hailey Schoelkopf <[email protected]>

* Update lm_eval/utils.py

Co-authored-by: Hailey Schoelkopf <[email protected]>

* Update utils.py

* re-added old functions with new log message

* Update docs/new_task_guide.md

Co-authored-by: Hailey Schoelkopf <[email protected]>

* Update new_task_guide.md

* added infor regarding `get_task_dict` and documentation

* add get_config for Task

* pre-commit formatting

---------

Co-authored-by: Hailey Schoelkopf <[email protected]>
2024-02-01 23:31:15 +07:00
LSinev 488759d2c9 Apply some best practices and guideline recommendations to code (#1363)
* raise Exception, not a string

Additional info https://peps.python.org/pep-0352/#exception-hierarchy-changes
https://docs.python.org/3.8/tutorial/errors.html#raising-exceptions

* Apply PEP8 recommendation to prefer isinstance

"Object type comparisons should always use isinstance() instead of comparing types directly"
https://peps.python.org/pep-0008/

* Remove dangerous default mutable values in arguments

https://pylint.readthedocs.io/en/stable/user_guide/messages/warning/dangerous-default-value.html

* Format logging messages with fstring (not with format)

Additional info
https://pylint.readthedocs.io/en/stable/user_guide/messages/warning/logging-format-interpolation.html
There are also discussions about the speed of formatting while logging or some unintended code executions
https://github.com/pylint-dev/pylint/issues/2395
https://stackoverflow.com/a/54368109
but at least one format (fstring one) will be used throughout the project

* Specify utf-8 encoding for `open` explicitly

If not specified, it may be supposed differently in different environments, OSes, and Python versions. See
https://peps.python.org/pep-0597/
https://docs.python.org/3.11/library/locale.html#locale.getencoding
https://docs.python.org/3.10/library/os.html#utf8-mode
https://pylint.readthedocs.io/en/stable/user_guide/messages/warning/unspecified-encoding.html

Helps also if some code from English language tasks is taken as inspiration for tasks in non-English languages.

* Use inline-ignoring comments to pass pre-commit instead of identity process

https://flake8.pycqa.org/en/3.0.1/user/ignoring-errors.html#in-line-ignoring-errors
https://www.flake8rules.com/rules/F841.html

flake8 comments are supported by ruff: https://docs.astral.sh/ruff/linter/#error-suppression
2024-01-28 15:44:08 -05:00
Alex Bäuerle 46c7966449 add length of strings and answer options to metadata (#1222) 2023-12-28 09:34:20 -05:00
Baber Abbasi 65b8761db9 Switch Linting to ruff (#1166)
* add ruff and isort. remove black and flake8

* remove unnecessary dependencies

* remove dependency from table

* change order

* ran ruff

* check 3.9

* exclude evaluator

* update CI workflow

* use ruff config in pyproject.toml

* test

* add isort rules to ruff

* sort imports

* import `make_table`

* try stages for no-commit-to-branch

* turn on mypy for pre-commit

* test

* test

* test

* change no-commit-to-branch to default

* nits

* fixed dependency
2023-12-20 09:14:46 -05:00
Alex BäuerleandHailey Schoelkopf 21d4ae98c1 feat: add option to upload results to Zeno (#990)
* feat: add option to upload results to Zeno

* config-based upload supporting different task types and metrics

* upload tasks as individual projects

* wording

* readme

* add example notebook

* Update documentation for Zeno integration

* Make zeno deps an extra

* Update README.md

* Document extra deps installation

* Update zeno_visualize.py

* fix: balance parens

* fix typo

* fix merge commit I botched

* Update zeno_visualize.py

* Update logger warning stmt

* fix whitespace

---------

Co-authored-by: Hailey Schoelkopf <[email protected]>
2023-12-20 09:12:08 -05:00
Baber Abbasi 35a65ba05f add utils.clear_torch_cache() (#1142) 2023-12-15 18:12:31 -05:00
Baber Abbasi 72e583d5fa Unpack group in write_out (#1113)
* unpack group; add output_path to arg

* Add `vllm` to overview
2023-12-13 10:20:01 -05:00
baberabb 1c62da1ded fix batch 2023-12-06 19:11:38 +05:00
baberabb 38e3b73f0e nits 2023-12-06 18:08:57 +05:00
baberabb 8b74beaaa7 fix z-score and print; rename script 2023-12-06 18:01:41 +05:00
baberabb b99ad796d0 fix errors 2023-12-06 15:59:51 +05:00
baberabb a4188e1d4b nits 2023-12-06 15:21:04 +05:00
baberabb f44aa85fb9 add script to check vllm, hf equiv 2023-12-06 15:17:36 +05:00
lintangsutawika 66eed4bbaf update script to use initialize_tasks 2023-11-17 15:46:30 +00:00
Michael Pieler 1a183d0374 fix: copy paste mistake 2023-10-20 18:45:36 +02:00
Michael Pieler 1964ccd302 feat: add --include_path option to write out 2023-10-20 18:42:45 +02:00
haileyschoelkopf c28d100d00 replace the rest of the 'greedy_until' occurrences 2023-10-18 19:10:08 +00:00
Lintang Sutawika d7ddf525cb Merge pull request #842 from Hojjat-Mokhtarabadi/big-refactor
undefined type and output_type when using promptsource fixed
2023-09-19 22:43:35 +07:00
Lintang Sutawika a89b132dc4 Update write_out.py 2023-09-19 11:26:59 +07:00
Lintang Sutawika 0f3f1267be Update write_out.py 2023-09-19 10:37:25 +07:00
Chris 0ed5527a37 Fix "local variable 'docs' referenced before assignment" error in write_out.py 2023-09-14 16:40:10 +02:00
Hojjat Mokhtarabadi 7a46245317 undefined type and output_type when using promptsource fixed 2023-09-10 15:45:23 +03:30
Lintang Sutawika 027fe14cd4 Merge branch 'big-refactor' into benchmark-scripts 2023-07-17 21:06:14 +07:00
baberabb 73b2149fa1 removed rnd from task.fewshot_context in write_out.py; add mps in huggingface.py 2023-07-15 17:44:05 +01:00
lintangsutawika c70383d546 simplify 2023-07-14 16:09:32 +00:00