Skip to content

Commit f4b50b4

Browse files
committed
Better error message
1 parent 0725f0b commit f4b50b4

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

scripts/hf_eval.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
import torch
22

33
from transformers import AutoModelForCausalLM, AutoTokenizer
4+
try:
5+
from lm_eval.models.huggingface import HFLM
6+
from lm_eval.evaluator import evaluate
7+
from lm_eval.tasks import get_task_dict
8+
except ImportError as e:
9+
print("""
10+
Error: The 'lm_eval' module was not found.
11+
To install, follow these steps:
412
5-
from lm_eval.models.huggingface import HFLM
6-
from lm_eval.evaluator import evaluate
7-
from lm_eval.tasks import get_task_dict
13+
1. Clone the repository:
14+
git clone https://github.com/EleutherAI/lm-evaluation-harness
15+
16+
2. Change to the cloned directory:
17+
cd lm-evaluation-harness
18+
19+
3. Install the package in editable mode:
20+
pip install -e .
21+
22+
After installation, re-run this script to use the LM Evaluation Harness.
23+
""")
24+
raise # Re-raise the ImportError
825

926
from torchao.quantization.quant_api import (
1027
change_linear_weights_to_int4_woqtensors,

0 commit comments

Comments
 (0)