-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make pytorch an optional dependency #2004
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,26 +19,24 @@ classifiers = [ | |
requires-python = ">=3.8" | ||
license = { "text" = "MIT" } | ||
dependencies = [ | ||
"accelerate>=0.26.0", | ||
"evaluate", | ||
"datasets>=2.16.0", | ||
"evaluate>=0.4.0", | ||
"jsonlines", | ||
"numexpr", | ||
"peft>=0.2.0", | ||
"pybind11>=2.6.2", | ||
"pytablewriter", | ||
"rouge-score>=0.0.4", | ||
"sacrebleu>=1.5.0", | ||
"scikit-learn>=0.24.1", | ||
"sqlitedict", | ||
"torch>=1.8", | ||
"tqdm-multiprocess", | ||
"transformers>=4.1", | ||
"zstandard", | ||
"dill", | ||
"word2number", | ||
"more_itertools", | ||
"jinja2>=3.0.0", | ||
] | ||
|
||
[tool.setuptools.packages.find] | ||
|
@@ -57,8 +55,10 @@ Homepage = "https://github.com/EleutherAI/lm-evaluation-harness" | |
Repository = "https://github.com/EleutherAI/lm-evaluation-harness" | ||
|
||
[project.optional-dependencies] | ||
torch = ["torch>=1.8"] | ||
hf = ["transformers", "torch>=1.8", "accelerate>=0.26.0", "peft>=0.2.0"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. two new extras. My guess is that people will generally want these, but pip has no way of specifying a "default" install and a "minimal" install. |
||
anthropic = ["anthropic"] | ||
dev = ["pytest", "pytest-cov", "pytest-xdist", "pre-commit", "mypy"] | ||
dev = ["pytest", "pytest-cov", "pytest-xdist", "pre-commit", "mypy", "accelerate>=0.26.0", "peft>=0.2.0"] | ||
deepsparse = ["deepsparse-nightly[llm]>=1.8.0.20240404"] | ||
gptq = ["auto-gptq[triton]>=0.6.0"] | ||
hf_transfer = ["hf_transfer"] | ||
|
@@ -78,6 +78,8 @@ zeno = ["pandas", "zeno-client"] | |
wandb = ["wandb>=0.16.3", "pandas", "numpy"] | ||
unitxt = ["unitxt"] | ||
all = [ | ||
"lm_eval[torch]", | ||
"lm_eval[hf]", | ||
"lm_eval[anthropic]", | ||
"lm_eval[dev]", | ||
"lm_eval[deepsparse]", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
import lm_eval.api as api | ||
import lm_eval.evaluator as evaluator | ||
from lm_eval import tasks | ||
from lm_eval.models.dummy import DummyLM | ||
from lm_eval.utils import make_table | ||
|
||
|
||
|
@@ -15,6 +16,25 @@ | |
# test once we break evaluator into smaller, more manageable pieces | ||
|
||
|
||
def test_evaluator_with_dummy_lm(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ensured this test passes with torch not installed. |
||
task_name = "hellaswag" | ||
limit = 10 | ||
lm = DummyLM() | ||
|
||
task_manager = tasks.TaskManager() | ||
task_dict = tasks.get_task_dict([task_name], task_manager) | ||
|
||
e = evaluator.evaluate( | ||
lm=lm, | ||
task_dict=task_dict, | ||
limit=limit, | ||
bootstrap_iters=0, | ||
) | ||
|
||
# mostly just checking it has a pulse | ||
del e | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"task_name,limit,model,model_args,bootstrap_iters", | ||
[ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by fix since I needed to do some mucking around in here anyway