chen459664 commited on
Commit
998922f
·
verified ·
1 Parent(s): 3cfb536

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval.egg-info/PKG-INFO +631 -0
  2. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval.egg-info/SOURCES.txt +0 -0
  3. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval.egg-info/entry_points.txt +3 -0
  4. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval.egg-info/requires.txt +132 -0
  5. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval.egg-info/top_level.txt +1 -0
  6. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/unitxt/dbpedia_14.yaml +3 -0
  7. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/unitxt/law_stack_exchange.yaml +3 -0
  8. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/unitxt/yahoo_answers_topics.yaml +3 -0
  9. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/unscramble/README.md +57 -0
  10. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/unscramble/anagrams1.yaml +22 -0
  11. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/webqs/utils.py +27 -0
  12. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/webqs/webqs.yaml +20 -0
  13. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmdp/README.md +50 -0
  14. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmdp/_default_template_yaml +15 -0
  15. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmdp/wmdp_bio.yaml +4 -0
  16. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmdp/wmdp_chem.yaml +4 -0
  17. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmt2016/README.md +49 -0
  18. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmt2016/metrics.py +11 -0
  19. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wsc273/README.md +60 -0
  20. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wsc273/utils.py +36 -0
  21. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/README.md +60 -0
  22. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/_xcopa.yaml +19 -0
  23. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_et.yaml +13 -0
  24. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_ht.yaml +4 -0
  25. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_id.yaml +4 -0
  26. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_it.yaml +4 -0
  27. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_qu.yaml +4 -0
  28. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_sw.yaml +4 -0
  29. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_ta.yaml +4 -0
  30. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_tr.yaml +4 -0
  31. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_vi.yaml +4 -0
  32. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_zh.yaml +4 -0
  33. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/utils.py +114 -0
  34. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/README.md +78 -0
  35. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/_xnli.yaml +23 -0
  36. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/utils.py +166 -0
  37. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_ar.yaml +7 -0
  38. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_bg.yaml +7 -0
  39. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_common_yaml +18 -0
  40. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_de.yaml +7 -0
  41. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_el.yaml +7 -0
  42. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_en.yaml +7 -0
  43. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_es.yaml +7 -0
  44. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_fr.yaml +7 -0
  45. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_hi.yaml +7 -0
  46. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_ru.yaml +7 -0
  47. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_sw.yaml +7 -0
  48. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_th.yaml +7 -0
  49. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_tr.yaml +7 -0
  50. lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_ur.yaml +7 -0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval.egg-info/PKG-INFO ADDED
@@ -0,0 +1,631 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: lm_eval
3
+ Version: 0.4.5
4
+ Summary: A framework for evaluating language models
5
+ Author-email: EleutherAI <contact@eleuther.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/EleutherAI/lm-evaluation-harness
8
+ Project-URL: Repository, https://github.com/EleutherAI/lm-evaluation-harness
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE.md
16
+ Requires-Dist: accelerate>=0.26.0
17
+ Requires-Dist: evaluate
18
+ Requires-Dist: datasets>=2.16.0
19
+ Requires-Dist: evaluate>=0.4.0
20
+ Requires-Dist: jsonlines
21
+ Requires-Dist: numexpr
22
+ Requires-Dist: peft>=0.2.0
23
+ Requires-Dist: pybind11>=2.6.2
24
+ Requires-Dist: pytablewriter
25
+ Requires-Dist: rouge-score>=0.0.4
26
+ Requires-Dist: sacrebleu>=1.5.0
27
+ Requires-Dist: scikit-learn>=0.24.1
28
+ Requires-Dist: sqlitedict
29
+ Requires-Dist: torch>=1.8
30
+ Requires-Dist: tqdm-multiprocess
31
+ Requires-Dist: transformers>=4.1
32
+ Requires-Dist: zstandard
33
+ Requires-Dist: dill
34
+ Requires-Dist: word2number
35
+ Requires-Dist: more_itertools
36
+ Provides-Extra: api
37
+ Requires-Dist: requests; extra == "api"
38
+ Requires-Dist: aiohttp; extra == "api"
39
+ Requires-Dist: tenacity; extra == "api"
40
+ Requires-Dist: tqdm; extra == "api"
41
+ Requires-Dist: tiktoken; extra == "api"
42
+ Provides-Extra: dev
43
+ Requires-Dist: pytest; extra == "dev"
44
+ Requires-Dist: pytest-cov; extra == "dev"
45
+ Requires-Dist: pytest-xdist; extra == "dev"
46
+ Requires-Dist: pre-commit; extra == "dev"
47
+ Requires-Dist: mypy; extra == "dev"
48
+ Provides-Extra: deepsparse
49
+ Requires-Dist: deepsparse-nightly[llm]>=1.8.0.20240404; extra == "deepsparse"
50
+ Provides-Extra: gptq
51
+ Requires-Dist: auto-gptq[triton]>=0.6.0; extra == "gptq"
52
+ Provides-Extra: awq
53
+ Requires-Dist: auto-awq>=0.2.6; extra == "awq"
54
+ Provides-Extra: hqq
55
+ Requires-Dist: hqq>=0.2.1; extra == "hqq"
56
+ Provides-Extra: hf-transfer
57
+ Requires-Dist: hf_transfer; extra == "hf-transfer"
58
+ Provides-Extra: ibm-watsonx-ai
59
+ Requires-Dist: ibm_watsonx_ai>=1.1.22; extra == "ibm-watsonx-ai"
60
+ Provides-Extra: ifeval
61
+ Requires-Dist: langdetect; extra == "ifeval"
62
+ Requires-Dist: immutabledict; extra == "ifeval"
63
+ Requires-Dist: nltk>=3.9.1; extra == "ifeval"
64
+ Provides-Extra: neuronx
65
+ Requires-Dist: optimum[neuronx]; extra == "neuronx"
66
+ Provides-Extra: mamba
67
+ Requires-Dist: mamba_ssm; extra == "mamba"
68
+ Requires-Dist: causal-conv1d==1.0.2; extra == "mamba"
69
+ Provides-Extra: math
70
+ Requires-Dist: sympy>=1.12; extra == "math"
71
+ Requires-Dist: antlr4-python3-runtime==4.11; extra == "math"
72
+ Provides-Extra: multilingual
73
+ Requires-Dist: nagisa>=0.2.7; extra == "multilingual"
74
+ Requires-Dist: jieba>=0.42.1; extra == "multilingual"
75
+ Requires-Dist: pycountry; extra == "multilingual"
76
+ Provides-Extra: optimum
77
+ Requires-Dist: optimum[openvino]; extra == "optimum"
78
+ Provides-Extra: promptsource
79
+ Requires-Dist: promptsource>=0.2.3; extra == "promptsource"
80
+ Provides-Extra: sentencepiece
81
+ Requires-Dist: sentencepiece>=0.1.98; extra == "sentencepiece"
82
+ Provides-Extra: sparseml
83
+ Requires-Dist: sparseml-nightly[llm]>=1.8.0.20240404; extra == "sparseml"
84
+ Provides-Extra: testing
85
+ Requires-Dist: pytest; extra == "testing"
86
+ Requires-Dist: pytest-cov; extra == "testing"
87
+ Requires-Dist: pytest-xdist; extra == "testing"
88
+ Provides-Extra: vllm
89
+ Requires-Dist: vllm>=0.4.2; extra == "vllm"
90
+ Provides-Extra: zeno
91
+ Requires-Dist: pandas; extra == "zeno"
92
+ Requires-Dist: zeno-client; extra == "zeno"
93
+ Provides-Extra: wandb
94
+ Requires-Dist: wandb>=0.16.3; extra == "wandb"
95
+ Requires-Dist: pandas; extra == "wandb"
96
+ Requires-Dist: numpy; extra == "wandb"
97
+ Provides-Extra: gptqmodel
98
+ Requires-Dist: gptqmodel>=1.0.9; extra == "gptqmodel"
99
+ Provides-Extra: japanese-leaderboard
100
+ Requires-Dist: emoji==2.14.0; extra == "japanese-leaderboard"
101
+ Requires-Dist: neologdn==0.5.3; extra == "japanese-leaderboard"
102
+ Requires-Dist: fugashi[unidic-lite]; extra == "japanese-leaderboard"
103
+ Requires-Dist: rouge_score>=0.1.2; extra == "japanese-leaderboard"
104
+ Provides-Extra: all
105
+ Requires-Dist: lm_eval[anthropic]; extra == "all"
106
+ Requires-Dist: lm_eval[dev]; extra == "all"
107
+ Requires-Dist: lm_eval[deepsparse]; extra == "all"
108
+ Requires-Dist: lm_eval[gptq]; extra == "all"
109
+ Requires-Dist: lm_eval[hf_transfer]; extra == "all"
110
+ Requires-Dist: lm_eval[ibm_watsonx_ai]; extra == "all"
111
+ Requires-Dist: lm_eval[ifeval]; extra == "all"
112
+ Requires-Dist: lm_eval[mamba]; extra == "all"
113
+ Requires-Dist: lm_eval[math]; extra == "all"
114
+ Requires-Dist: lm_eval[multilingual]; extra == "all"
115
+ Requires-Dist: lm_eval[openai]; extra == "all"
116
+ Requires-Dist: lm_eval[promptsource]; extra == "all"
117
+ Requires-Dist: lm_eval[sentencepiece]; extra == "all"
118
+ Requires-Dist: lm_eval[sparseml]; extra == "all"
119
+ Requires-Dist: lm_eval[testing]; extra == "all"
120
+ Requires-Dist: lm_eval[vllm]; extra == "all"
121
+ Requires-Dist: lm_eval[zeno]; extra == "all"
122
+ Requires-Dist: lm_eval[wandb]; extra == "all"
123
+ Requires-Dist: lm_eval[japanese_leaderboard]; extra == "all"
124
+ Dynamic: license-file
125
+
126
+ # Language Model Evaluation Harness
127
+
128
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10256836.svg)](https://doi.org/10.5281/zenodo.10256836)
129
+
130
+ ---
131
+
132
+ *Latest News 📣*
133
+
134
+ - [2024/09] We are prototyping allowing users of LM Evaluation Harness to create and evaluate on text+image multimodal input, text output tasks, and have just added the `hf-multimodal` and `vllm-vlm` model types and `mmmu` task as a prototype feature. We welcome users to try out this in-progress feature and stress-test it for themselves, and suggest they check out [`lmms-eval`](https://github.com/EvolvingLMMs-Lab/lmms-eval), a wonderful project originally forking off of the lm-evaluation-harness, for a broader range of multimodal tasks, models, and features.
135
+ - [2024/07] [API model](docs/API_guide.md) support has been updated and refactored, introducing support for batched and async requests, and making it significantly easier to customize and use for your own purposes. **To run Llama 405B, we recommend using VLLM's OpenAI-compliant API to host the model, and use the `local-completions` model type to evaluate the model.**
136
+ - [2024/07] New Open LLM Leaderboard tasks have been added ! You can find them under the [leaderboard](lm_eval/tasks/leaderboard/README.md) task group.
137
+
138
+ ---
139
+
140
+ ## Announcement
141
+ **A new v0.4.0 release of lm-evaluation-harness is available** !
142
+
143
+ New updates and features include:
144
+
145
+ - **New Open LLM Leaderboard tasks have been added ! You can find them under the [leaderboard](lm_eval/tasks/leaderboard/README.md) task group.**
146
+ - Internal refactoring
147
+ - Config-based task creation and configuration
148
+ - Easier import and sharing of externally-defined task config YAMLs
149
+ - Support for Jinja2 prompt design, easy modification of prompts + prompt imports from Promptsource
150
+ - More advanced configuration options, including output post-processing, answer extraction, and multiple LM generations per document, configurable fewshot settings, and more
151
+ - Speedups and new modeling libraries supported, including: faster data-parallel HF model usage, vLLM support, MPS support with HuggingFace, and more
152
+ - Logging and usability changes
153
+ - New tasks including CoT BIG-Bench-Hard, Belebele, user-defined task groupings, and more
154
+
155
+ Please see our updated documentation pages in `docs/` for more details.
156
+
157
+ Development will be continuing on the `main` branch, and we encourage you to give us feedback on what features are desired and how to improve the library further, or ask questions, either in issues or PRs on GitHub, or in the [EleutherAI discord](https://discord.gg/eleutherai)!
158
+
159
+ ---
160
+
161
+ ## Overview
162
+
163
+ This project provides a unified framework to test generative language models on a large number of different evaluation tasks.
164
+
165
+ **Features:**
166
+ - Over 60 standard academic benchmarks for LLMs, with hundreds of subtasks and variants implemented.
167
+ - Support for models loaded via [transformers](https://github.com/huggingface/transformers/) (including quantization via [GPTQModel](https://github.com/ModelCloud/GPTQModel) and [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ)), [GPT-NeoX](https://github.com/EleutherAI/gpt-neox), and [Megatron-DeepSpeed](https://github.com/microsoft/Megatron-DeepSpeed/), with a flexible tokenization-agnostic interface.
168
+ - Support for fast and memory-efficient inference with [vLLM](https://github.com/vllm-project/vllm).
169
+ - Support for commercial APIs including [OpenAI](https://openai.com), and [TextSynth](https://textsynth.com/).
170
+ - Support for evaluation on adapters (e.g. LoRA) supported in [HuggingFace's PEFT library](https://github.com/huggingface/peft).
171
+ - Support for local models and benchmarks.
172
+ - Evaluation with publicly available prompts ensures reproducibility and comparability between papers.
173
+ - Easy support for custom prompts and evaluation metrics.
174
+
175
+ The Language Model Evaluation Harness is the backend for 🤗 Hugging Face's popular [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard), has been used in [hundreds of papers](https://scholar.google.com/scholar?oi=bibs&hl=en&authuser=2&cites=15052937328817631261,4097184744846514103,1520777361382155671,17476825572045927382,18443729326628441434,14801318227356878622,7890865700763267262,12854182577605049984,15641002901115500560,5104500764547628290), and is used internally by dozens of organizations including NVIDIA, Cohere, BigScience, BigCode, Nous Research, and Mosaic ML.
176
+
177
+ ## Install
178
+
179
+ To install the `lm-eval` package from the github repository, run:
180
+
181
+ ```bash
182
+ git clone --depth 1 https://github.com/EleutherAI/lm-evaluation-harness
183
+ cd lm-evaluation-harness
184
+ pip install -e .
185
+ ```
186
+
187
+ We also provide a number of optional dependencies for extended functionality. A detailed table is available at the end of this document.
188
+
189
+ ## Basic Usage
190
+ ### User Guide
191
+
192
+ A user guide detailing the full list of supported arguments is provided [here](./docs/interface.md), and on the terminal by calling `lm_eval -h`. Alternatively, you can use `lm-eval` instead of `lm_eval`.
193
+
194
+ A list of supported tasks (or groupings of tasks) can be viewed with `lm-eval --tasks list`. Task descriptions and links to corresponding subfolders are provided [here](./lm_eval/tasks/README.md).
195
+
196
+ ### Hugging Face `transformers`
197
+
198
+ To evaluate a model hosted on the [HuggingFace Hub](https://huggingface.co/models) (e.g. GPT-J-6B) on `hellaswag` you can use the following command (this assumes you are using a CUDA-compatible GPU):
199
+
200
+ ```bash
201
+ lm_eval --model hf \
202
+ --model_args pretrained=EleutherAI/gpt-j-6B \
203
+ --tasks hellaswag \
204
+ --device cuda:0 \
205
+ --batch_size 8
206
+ ```
207
+
208
+ Additional arguments can be provided to the model constructor using the `--model_args` flag. Most notably, this supports the common practice of using the `revisions` feature on the Hub to store partially trained checkpoints, or to specify the datatype for running a model:
209
+
210
+ ```bash
211
+ lm_eval --model hf \
212
+ --model_args pretrained=EleutherAI/pythia-160m,revision=step100000,dtype="float" \
213
+ --tasks lambada_openai,hellaswag \
214
+ --device cuda:0 \
215
+ --batch_size 8
216
+ ```
217
+
218
+ Models that are loaded via both `transformers.AutoModelForCausalLM` (autoregressive, decoder-only GPT style models) and `transformers.AutoModelForSeq2SeqLM` (such as encoder-decoder models like T5) in Huggingface are supported.
219
+
220
+ Batch size selection can be automated by setting the ```--batch_size``` flag to ```auto```. This will perform automatic detection of the largest batch size that will fit on your device. On tasks where there is a large difference between the longest and shortest example, it can be helpful to periodically recompute the largest batch size, to gain a further speedup. To do this, append ```:N``` to above flag to automatically recompute the largest batch size ```N``` times. For example, to recompute the batch size 4 times, the command would be:
221
+
222
+ ```bash
223
+ lm_eval --model hf \
224
+ --model_args pretrained=EleutherAI/pythia-160m,revision=step100000,dtype="float" \
225
+ --tasks lambada_openai,hellaswag \
226
+ --device cuda:0 \
227
+ --batch_size auto:4
228
+ ```
229
+
230
+ > [!Note]
231
+ > Just like you can provide a local path to `transformers.AutoModel`, you can also provide a local path to `lm_eval` via `--model_args pretrained=/path/to/model`
232
+
233
+ #### Multi-GPU Evaluation with Hugging Face `accelerate`
234
+
235
+ We support three main ways of using Hugging Face's [accelerate 🚀](https://github.com/huggingface/accelerate) library for multi-GPU evaluation.
236
+
237
+ To perform *data-parallel evaluation* (where each GPU loads a **separate full copy** of the model), we leverage the `accelerate` launcher as follows:
238
+
239
+ ```
240
+ accelerate launch -m lm_eval --model hf \
241
+ --tasks lambada_openai,arc_easy \
242
+ --batch_size 16
243
+ ```
244
+ (or via `accelerate launch --no-python lm_eval`).
245
+
246
+ For cases where your model can fit on a single GPU, this allows you to evaluate on K GPUs K times faster than on one.
247
+
248
+ **WARNING**: This setup does not work with FSDP model sharding, so in `accelerate config` FSDP must be disabled, or the NO_SHARD FSDP option must be used.
249
+
250
+ The second way of using `accelerate` for multi-GPU evaluation is when your model is *too large to fit on a single GPU.*
251
+
252
+ In this setting, run the library *outside the `accelerate` launcher*, but passing `parallelize=True` to `--model_args` as follows:
253
+
254
+ ```
255
+ lm_eval --model hf \
256
+ --tasks lambada_openai,arc_easy \
257
+ --model_args parallelize=True \
258
+ --batch_size 16
259
+ ```
260
+
261
+ This means that your model's weights will be split across all available GPUs.
262
+
263
+ For more advanced users or even larger models, we allow for the following arguments when `parallelize=True` as well:
264
+ - `device_map_option`: How to split model weights across available GPUs. defaults to "auto".
265
+ - `max_memory_per_gpu`: the max GPU memory to use per GPU in loading the model.
266
+ - `max_cpu_memory`: the max amount of CPU memory to use when offloading the model weights to RAM.
267
+ - `offload_folder`: a folder where model weights will be offloaded to disk if needed.
268
+
269
+ The third option is to use both at the same time. This will allow you to take advantage of both data parallelism and model sharding, and is especially useful for models that are too large to fit on a single GPU.
270
+
271
+ ```
272
+ accelerate launch --multi_gpu --num_processes {nb_of_copies_of_your_model} \
273
+ -m lm_eval --model hf \
274
+ --tasks lambada_openai,arc_easy \
275
+ --model_args parallelize=True \
276
+ --batch_size 16
277
+ ```
278
+
279
+ To learn more about model parallelism and how to use it with the `accelerate` library, see the [accelerate documentation](https://huggingface.co/docs/transformers/v4.15.0/en/parallelism)
280
+
281
+ **Warning: We do not natively support multi-node evaluation using the `hf` model type! Please reference [our GPT-NeoX library integration](https://github.com/EleutherAI/gpt-neox/blob/main/eval.py) for an example of code in which a custom multi-machine evaluation script is written.**
282
+
283
+ **Note: we do not currently support multi-node evaluations natively, and advise using either an externally hosted server to run inference requests against, or creating a custom integration with your distributed framework [as is done for the GPT-NeoX library](https://github.com/EleutherAI/gpt-neox/blob/main/eval_tasks/eval_adapter.py).**
284
+
285
+ ### NVIDIA `nemo` models
286
+
287
+ [NVIDIA NeMo Framework](https://github.com/NVIDIA/NeMo) is a generative AI framework built for researchers and pytorch developers working on language models.
288
+
289
+ To evaluate a `nemo` model, start by installing NeMo following [the documentation](https://github.com/NVIDIA/NeMo?tab=readme-ov-file#installation). We highly recommended to use the NVIDIA PyTorch or NeMo container, especially if having issues installing Apex or any other dependencies (see [latest released containers](https://github.com/NVIDIA/NeMo/releases)). Please also install the lm evaluation harness library following the instructions in [the Install section](https://github.com/EleutherAI/lm-evaluation-harness/tree/main?tab=readme-ov-file#install).
290
+
291
+ NeMo models can be obtained through [NVIDIA NGC Catalog](https://catalog.ngc.nvidia.com/models) or in [NVIDIA's Hugging Face page](https://huggingface.co/nvidia). In [NVIDIA NeMo Framework](https://github.com/NVIDIA/NeMo/tree/main/scripts/nlp_language_modeling) there are conversion scripts to convert the `hf` checkpoints of popular models like llama, falcon, mixtral or mpt to `nemo`.
292
+
293
+ Run a `nemo` model on one GPU:
294
+ ```bash
295
+ lm_eval --model nemo_lm \
296
+ --model_args path=<path_to_nemo_model> \
297
+ --tasks hellaswag \
298
+ --batch_size 32
299
+ ```
300
+
301
+ It is recommended to unpack the `nemo` model to avoid the unpacking inside the docker container - it may overflow disk space. For that you can run:
302
+
303
+ ```
304
+ mkdir MY_MODEL
305
+ tar -xvf MY_MODEL.nemo -c MY_MODEL
306
+ ```
307
+
308
+ #### Multi-GPU evaluation with NVIDIA `nemo` models
309
+
310
+ By default, only one GPU is used. But we do support either data replication or tensor/pipeline parallelism during evaluation, on one node.
311
+
312
+ 1) To enable data replication, set the `model_args` of `devices` to the number of data replicas to run. For example, the command to run 8 data replicas over 8 GPUs is:
313
+ ```bash
314
+ torchrun --nproc-per-node=8 --no-python lm_eval \
315
+ --model nemo_lm \
316
+ --model_args path=<path_to_nemo_model>,devices=8 \
317
+ --tasks hellaswag \
318
+ --batch_size 32
319
+ ```
320
+
321
+ 2) To enable tensor and/or pipeline parallelism, set the `model_args` of `tensor_model_parallel_size` and/or `pipeline_model_parallel_size`. In addition, you also have to set up `devices` to be equal to the product of `tensor_model_parallel_size` and/or `pipeline_model_parallel_size`. For example, the command to use one node of 4 GPUs with tensor parallelism of 2 and pipeline parallelism of 2 is:
322
+ ```bash
323
+ torchrun --nproc-per-node=4 --no-python lm_eval \
324
+ --model nemo_lm \
325
+ --model_args path=<path_to_nemo_model>,devices=4,tensor_model_parallel_size=2,pipeline_model_parallel_size=2 \
326
+ --tasks hellaswag \
327
+ --batch_size 32
328
+ ```
329
+ Note that it is recommended to substitute the `python` command by `torchrun --nproc-per-node=<number of devices> --no-python` to facilitate loading the model into the GPUs. This is especially important for large checkpoints loaded into multiple GPUs.
330
+
331
+ Not supported yet: multi-node evaluation and combinations of data replication with tensor or pipeline parallelism.
332
+
333
+ ### Tensor + Data Parallel and Optimized Inference with `vLLM`
334
+
335
+ We also support vLLM for faster inference on [supported model types](https://docs.vllm.ai/en/latest/models/supported_models.html), especially faster when splitting a model across multiple GPUs. For single-GPU or multi-GPU — tensor parallel, data parallel, or a combination of both — inference, for example:
336
+
337
+ ```bash
338
+ lm_eval --model vllm \
339
+ --model_args pretrained={model_name},tensor_parallel_size={GPUs_per_model},dtype=auto,gpu_memory_utilization=0.8,data_parallel_size={model_replicas} \
340
+ --tasks lambada_openai \
341
+ --batch_size auto
342
+ ```
343
+ To use vllm, do `pip install lm_eval[vllm]`. For a full list of supported vLLM configurations, please reference our [vLLM integration](https://github.com/EleutherAI/lm-evaluation-harness/blob/e74ec966556253fbe3d8ecba9de675c77c075bce/lm_eval/models/vllm_causallms.py) and the vLLM documentation.
344
+
345
+ vLLM occasionally differs in output from Huggingface. We treat Huggingface as the reference implementation, and provide a [script](./scripts/model_comparator.py) for checking the validity of vllm results against HF.
346
+
347
+ > [!Tip]
348
+ > For fastest performance, we recommend using `--batch_size auto` for vLLM whenever possible, to leverage its continuous batching functionality!
349
+
350
+ > [!Tip]
351
+ > Passing `max_model_len=4096` or some other reasonable default to vLLM through model args may cause speedups or prevent out-of-memory errors when trying to use auto batch size, such as for Mistral-7B-v0.1 which defaults to a maximum length of 32k.
352
+
353
+ ### Model APIs and Inference Servers
354
+
355
+ Our library also supports the evaluation of models served via several commercial APIs, and we hope to implement support for the most commonly used performant local/self-hosted inference servers.
356
+
357
+ To call a hosted model, use:
358
+
359
+ ```bash
360
+ export OPENAI_API_KEY=YOUR_KEY_HERE
361
+ lm_eval --model openai-completions \
362
+ --model_args model=davinci \
363
+ --tasks lambada_openai,hellaswag
364
+ ```
365
+
366
+ We also support using your own local inference server with servers that mirror the OpenAI Completions and ChatCompletions APIs.
367
+
368
+ ```bash
369
+ lm_eval --model local-completions --tasks gsm8k --model_args model=facebook/opt-125m,base_url=http://{yourip}:8000/v1/completions,num_concurrent=1,max_retries=3,tokenized_requests=False,batch_size=16
370
+ ```
371
+ Note that for externally hosted models, configs such as `--device` which relate to where to place a local model should not be used and do not function. Just like you can use `--model_args` to pass arbitrary arguments to the model constructor for local models, you can use it to pass arbitrary arguments to the model API for hosted models. See the documentation of the hosting service for information on what arguments they support.
372
+
373
+ | API or Inference Server | Implemented? | `--model <xxx>` name | Models supported: | Request Types: |
374
+ |---------------------------------------------------------------------------------------------------------------------------|---------------------------------|-----------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
375
+ | OpenAI Completions | :heavy_check_mark: | `openai-completions`, `local-completions` | All OpenAI Completions API models | `generate_until`, `loglikelihood`, `loglikelihood_rolling` |
376
+ | OpenAI ChatCompletions | :heavy_check_mark: | `openai-chat-completions`, `local-chat-completions` | [All ChatCompletions API models](https://platform.openai.com/docs/guides/gpt) | `generate_until` (no logprobs) |
377
+ | Anthropic | :heavy_check_mark: | `anthropic` | [Supported Anthropic Engines](https://docs.anthropic.com/claude/reference/selecting-a-model) | `generate_until` (no logprobs) |
378
+ | Anthropic Chat | :heavy_check_mark: | `anthropic-chat`, `anthropic-chat-completions` | [Supported Anthropic Engines](https://docs.anthropic.com/claude/docs/models-overview) | `generate_until` (no logprobs) |
379
+ | Textsynth | :heavy_check_mark: | `textsynth` | [All supported engines](https://textsynth.com/documentation.html#engines) | `generate_until`, `loglikelihood`, `loglikelihood_rolling` |
380
+ | Cohere | [:hourglass: - blocked on Cohere API bug](https://github.com/EleutherAI/lm-evaluation-harness/pull/395) | N/A | [All `cohere.generate()` engines](https://docs.cohere.com/docs/models) | `generate_until`, `loglikelihood`, `loglikelihood_rolling` |
381
+ | [Llama.cpp](https://github.com/ggerganov/llama.cpp) (via [llama-cpp-python](https://github.com/abetlen/llama-cpp-python)) | :heavy_check_mark: | `gguf`, `ggml` | [All models supported by llama.cpp](https://github.com/ggerganov/llama.cpp) | `generate_until`, `loglikelihood`, (perplexity evaluation not yet implemented) |
382
+ | vLLM | :heavy_check_mark: | `vllm` | [Most HF Causal Language Models](https://docs.vllm.ai/en/latest/models/supported_models.html) | `generate_until`, `loglikelihood`, `loglikelihood_rolling` |
383
+ | Mamba | :heavy_check_mark: | `mamba_ssm` | [Mamba architecture Language Models via the `mamba_ssm` package](https://huggingface.co/state-spaces) | `generate_until`, `loglikelihood`, `loglikelihood_rolling` |
384
+ | Huggingface Optimum (Causal LMs) | ✔️ | `openvino` | Any decoder-only AutoModelForCausalLM converted with Huggingface Optimum into OpenVINO™ Intermediate Representation (IR) format | `generate_until`, `loglikelihood`, `loglikelihood_rolling` | ... |
385
+ | Neuron via AWS Inf2 (Causal LMs) | ✔️ | `neuronx` | Any decoder-only AutoModelForCausalLM supported to run on [huggingface-ami image for inferentia2](https://aws.amazon.com/marketplace/pp/prodview-gr3e6yiscria2) | `generate_until`, `loglikelihood`, `loglikelihood_rolling` | ... |
386
+ | [Neural Magic DeepSparse](https://github.com/neuralmagic/deepsparse) | ✔️ | `deepsparse` | Any LM from [SparseZoo](https://sparsezoo.neuralmagic.com/) or on [HF Hub with the "deepsparse" tag](https://huggingface.co/models?other=deepsparse) | `generate_until`, `loglikelihood` | ... |
387
+ | [Neural Magic SparseML](https://github.com/neuralmagic/sparseml) | ✔️ | `sparseml` | Any decoder-only AutoModelForCausalLM from [SparseZoo](https://sparsezoo.neuralmagic.com/) or on [HF Hub](https://huggingface.co/neuralmagic). Especially useful for models with quantization like [`zoo:llama2-7b-gsm8k_llama2_pretrain-pruned60_quantized`](https://sparsezoo.neuralmagic.com/models/llama2-7b-gsm8k_llama2_pretrain-pruned60_quantized) | `generate_until`, `loglikelihood`, `loglikelihood_rolling` | ... |
388
+ | Your local inference server! | :heavy_check_mark: | `local-completions` or `local-chat-completions` | Support for OpenAI API-compatible servers, with easy customization for other APIs. | `generate_until`, `loglikelihood`, `loglikelihood_rolling` | | ... |
389
+
390
+ Models which do not supply logits or logprobs can be used with tasks of type `generate_until` only, while local models, or APIs that supply logprobs/logits of their prompts, can be run on all task types: `generate_until`, `loglikelihood`, `loglikelihood_rolling`, and `multiple_choice`.
391
+
392
+ For more information on the different task `output_types` and model request types, see [our documentation](https://github.com/EleutherAI/lm-evaluation-harness/blob/main/docs/model_guide.md#interface).
393
+
394
+ > [!Note]
395
+ > For best performance with closed chat model APIs such as Anthropic Claude 3 and GPT-4, we recommend carefully looking at a few sample outputs using `--limit 10` first to confirm answer extraction and scoring on generative tasks is performing as expected. providing `system="<some system prompt here>"` within `--model_args` for anthropic-chat-completions, to instruct the model what format to respond in, may be useful.
396
+
397
+
398
+ ### Other Frameworks
399
+
400
+ A number of other libraries contain scripts for calling the eval harness through their library. These include [GPT-NeoX](https://github.com/EleutherAI/gpt-neox/blob/main/eval_tasks/eval_adapter.py), [Megatron-DeepSpeed](https://github.com/microsoft/Megatron-DeepSpeed/blob/main/examples/MoE/readme_evalharness.md), and [mesh-transformer-jax](https://github.com/kingoflolz/mesh-transformer-jax/blob/master/eval_harness.py).
401
+
402
+ To create your own custom integration you can follow instructions from [this tutorial](https://github.com/EleutherAI/lm-evaluation-harness/blob/main/docs/interface.md#external-library-usage).
403
+
404
+ ### Additional Features
405
+ > [!Note]
406
+ > For tasks unsuitable for direct evaluation — either due risks associated with executing untrusted code or complexities in the evaluation process — the `--predict_only` flag is available to obtain decoded generations for post-hoc evaluation.
407
+
408
+ If you have a Metal compatible Mac, you can run the eval harness using the MPS back-end by replacing `--device cuda:0` with `--device mps` (requires PyTorch version 2.1 or higher). **Note that the PyTorch MPS backend is still in early stages of development, so correctness issues or unsupported operations may exist. If you observe oddities in model performance on the MPS back-end, we recommend first checking that a forward pass of your model on `--device cpu` and `--device mps` match.**
409
+
410
+ > [!Note]
411
+ > You can inspect what the LM inputs look like by running the following command:
412
+ > ```bash
413
+ > python write_out.py \
414
+ > --tasks <task1,task2,...> \
415
+ > --num_fewshot 5 \
416
+ > --num_examples 10 \
417
+ > --output_base_path /path/to/output/folder
418
+ > ```
419
+ > This will write out one text file for each task.
420
+
421
+ To verify the data integrity of the tasks you're performing in addition to running the tasks themselves, you can use the `--check_integrity` flag:
422
+
423
+ ```bash
424
+ lm_eval --model openai \
425
+ --model_args engine=davinci \
426
+ --tasks lambada_openai,hellaswag \
427
+ --check_integrity
428
+ ```
429
+
430
+ ## Advanced Usage Tips
431
+
432
+ For models loaded with the HuggingFace `transformers` library, any arguments provided via `--model_args` get passed to the relevant constructor directly. This means that anything you can do with `AutoModel` can be done with our library. For example, you can pass a local path via `pretrained=` or use models finetuned with [PEFT](https://github.com/huggingface/peft) by taking the call you would run to evaluate the base model and add `,peft=PATH` to the `model_args` argument:
433
+ ```bash
434
+ lm_eval --model hf \
435
+ --model_args pretrained=EleutherAI/gpt-j-6b,parallelize=True,load_in_4bit=True,peft=nomic-ai/gpt4all-j-lora \
436
+ --tasks openbookqa,arc_easy,winogrande,hellaswag,arc_challenge,piqa,boolq \
437
+ --device cuda:0
438
+ ```
439
+
440
+ Models provided as delta weights can be easily loaded using the Hugging Face transformers library. Within --model_args, set the delta argument to specify the delta weights, and use the pretrained argument to designate the relative base model to which they will be applied:
441
+ ```bash
442
+ lm_eval --model hf \
443
+ --model_args pretrained=Ejafa/llama_7B,delta=lmsys/vicuna-7b-delta-v1.1 \
444
+ --tasks hellaswag
445
+ ```
446
+
447
+ GPTQ quantized models can be loaded using [GPTQModel](https://github.com/ModelCloud/GPTQModel) (faster) or [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ)
448
+
449
+ GPTQModel: add `,gptqmodel=True` to `model_args`
450
+ ```bash
451
+ lm_eval --model hf \
452
+ --model_args pretrained=model-name-or-path,gptqmodel=True \
453
+ --tasks hellaswag
454
+ ```
455
+
456
+ AutoGPTQ: add `,autogptq=True` to `model_args`:
457
+ ```bash
458
+ lm_eval --model hf \
459
+ --model_args pretrained=model-name-or-path,autogptq=model.safetensors,gptq_use_triton=True \
460
+ --tasks hellaswag
461
+ ```
462
+
463
+ We support wildcards in task names, for example you can run all of the machine-translated lambada tasks via `--task lambada_openai_mt_*`.
464
+
465
+ ## Saving Results
466
+
467
+ To save evaluation results provide an `--output_path`. We also support logging model responses with the `--log_samples` flag for post-hoc analysis.
468
+
469
+ Additionally, one can provide a directory with `--use_cache` to cache the results of prior runs. This allows you to avoid repeated execution of the same (model, task) pairs for re-scoring.
470
+
471
+ To push results and samples to the Hugging Face Hub, first ensure an access token with write access is set in the `HF_TOKEN` environment variable. Then, use the `--hf_hub_log_args` flag to specify the organization, repository name, repository visibility, and whether to push results and samples to the Hub - [example dataset on the HF Hub](https://huggingface.co/datasets/KonradSzafer/lm-eval-results-demo). For instance:
472
+
473
+ ```bash
474
+ lm_eval --model hf \
475
+ --model_args pretrained=model-name-or-path,autogptq=model.safetensors,gptq_use_triton=True \
476
+ --tasks hellaswag \
477
+ --log_samples \
478
+ --output_path results \
479
+ --hf_hub_log_args hub_results_org=EleutherAI,hub_repo_name=lm-eval-results,push_results_to_hub=True,push_samples_to_hub=True,public_repo=False \
480
+ ```
481
+
482
+ This allows you to easily download the results and samples from the Hub, using:
483
+ ```python
484
+ from datasets import load_dataset
485
+
486
+ load_dataset("EleutherAI/lm-eval-results-private", "hellaswag", "latest")
487
+ ```
488
+
489
+ For a full list of supported arguments, check out the [interface](https://github.com/EleutherAI/lm-evaluation-harness/blob/main/docs/interface.md) guide in our documentation!
490
+
491
+ ## Visualizing Results
492
+
493
+ You can seamlessly visualize and analyze the results of your evaluation harness runs using both Weights & Biases (W&B) and Zeno.
494
+
495
+ ### Zeno
496
+
497
+ You can use [Zeno](https://zenoml.com) to visualize the results of your eval harness runs.
498
+
499
+ First, head to [hub.zenoml.com](https://hub.zenoml.com) to create an account and get an API key [on your account page](https://hub.zenoml.com/account).
500
+ Add this key as an environment variable:
501
+
502
+ ```bash
503
+ export ZENO_API_KEY=[your api key]
504
+ ```
505
+
506
+ You'll also need to install the `lm_eval[zeno]` package extra.
507
+
508
+ To visualize the results, run the eval harness with the `log_samples` and `output_path` flags.
509
+ We expect `output_path` to contain multiple folders that represent individual model names.
510
+ You can thus run your evaluation on any number of tasks and models and upload all of the results as projects on Zeno.
511
+
512
+ ```bash
513
+ lm_eval \
514
+ --model hf \
515
+ --model_args pretrained=EleutherAI/gpt-j-6B \
516
+ --tasks hellaswag \
517
+ --device cuda:0 \
518
+ --batch_size 8 \
519
+ --log_samples \
520
+ --output_path output/gpt-j-6B
521
+ ```
522
+
523
+ Then, you can upload the resulting data using the `zeno_visualize` script:
524
+
525
+ ```bash
526
+ python scripts/zeno_visualize.py \
527
+ --data_path output \
528
+ --project_name "Eleuther Project"
529
+ ```
530
+
531
+ This will use all subfolders in `data_path` as different models and upload all tasks within these model folders to Zeno.
532
+ If you run the eval harness on multiple tasks, the `project_name` will be used as a prefix and one project will be created per task.
533
+
534
+ You can find an example of this workflow in [examples/visualize-zeno.ipynb](examples/visualize-zeno.ipynb).
535
+
536
+ ### Weights and Biases
537
+
538
+ With the [Weights and Biases](https://wandb.ai/site) integration, you can now spend more time extracting deeper insights into your evaluation results. The integration is designed to streamline the process of logging and visualizing experiment results using the Weights & Biases (W&B) platform.
539
+
540
+ The integration provide functionalities
541
+
542
+ - to automatically log the evaluation results,
543
+ - log the samples as W&B Tables for easy visualization,
544
+ - log the `results.json` file as an artifact for version control,
545
+ - log the `<task_name>_eval_samples.json` file if the samples are logged,
546
+ - generate a comprehensive report for analysis and visualization with all the important metric,
547
+ - log task and cli specific configs,
548
+ - and more out of the box like the command used to run the evaluation, GPU/CPU counts, timestamp, etc.
549
+
550
+ First you'll need to install the lm_eval[wandb] package extra. Do `pip install lm_eval[wandb]`.
551
+
552
+ Authenticate your machine with an your unique W&B token. Visit https://wandb.ai/authorize to get one. Do `wandb login` in your command line terminal.
553
+
554
+ Run eval harness as usual with a `wandb_args` flag. Use this flag to provide arguments for initializing a wandb run ([wandb.init](https://docs.wandb.ai/ref/python/init)) as comma separated string arguments.
555
+
556
+ ```bash
557
+ lm_eval \
558
+ --model hf \
559
+ --model_args pretrained=microsoft/phi-2,trust_remote_code=True \
560
+ --tasks hellaswag,mmlu_abstract_algebra \
561
+ --device cuda:0 \
562
+ --batch_size 8 \
563
+ --output_path output/phi-2 \
564
+ --limit 10 \
565
+ --wandb_args project=lm-eval-harness-integration \
566
+ --log_samples
567
+ ```
568
+
569
+ In the stdout, you will find the link to the W&B run page as well as link to the generated report. You can find an example of this workflow in [examples/visualize-wandb.ipynb](examples/visualize-wandb.ipynb), and an example of how to integrate it beyond the CLI.
570
+
571
+ ## How to Contribute or Learn More?
572
+
573
+ For more information on the library and how everything fits together, check out all of our [documentation pages](https://github.com/EleutherAI/lm-evaluation-harness/tree/main/docs)! We plan to post a larger roadmap of desired + planned library improvements soon, with more information on how contributors can help.
574
+
575
+ ### Implementing new tasks
576
+
577
+ To implement a new task in the eval harness, see [this guide](./docs/new_task_guide.md).
578
+
579
+ In general, we follow this priority list for addressing concerns about prompting and other eval details:
580
+ 1. If there is widespread agreement among people who train LLMs, use the agreed upon procedure.
581
+ 2. If there is a clear and unambiguous official implementation, use that procedure.
582
+ 3. If there is widespread agreement among people who evaluate LLMs, use the agreed upon procedure.
583
+ 4. If there are multiple common implementations but not universal or widespread agreement, use our preferred option among the common implementations. As before, prioritize choosing from among the implementations found in LLM training papers.
584
+
585
+ These are guidelines and not rules, and can be overruled in special circumstances.
586
+
587
+ We try to prioritize agreement with the procedures used by other groups to decrease the harm when people inevitably compare runs across different papers despite our discouragement of the practice. Historically, we also prioritized the implementation from [Language Models are Few Shot Learners](https://arxiv.org/abs/2005.14165) as our original goal was specifically to compare results with that paper.
588
+
589
+ ### Support
590
+
591
+ The best way to get support is to open an issue on this repo or join the [EleutherAI Discord server](https://discord.gg/eleutherai). The `#lm-thunderdome` channel is dedicated to developing this project and the `#release-discussion` channel is for receiving support for our releases. If you've used the library and have had a positive (or negative) experience, we'd love to hear from you!
592
+
593
+ ## Optional Extras
594
+ Extras dependencies can be installed via `pip install -e ".[NAME]"`
595
+
596
+ | Name | Use |
597
+ |-----------------|----------------------------------------------|
598
+ | api | For using api models (Anthropic, OpenAI API) |
599
+ | deepsparse | For running NM's DeepSparse models |
600
+ | dev | For linting PRs and contributions |
601
+ | gptq | For loading models with GPTQ |
602
+ | hf_transfer | For speeding up HF Hub file downloads |
603
+ | ifeval | For running the IFEval task |
604
+ | neuronx | For running on AWS inf2 instances |
605
+ | mamba | For loading Mamba SSM models |
606
+ | math | For running math task answer checking |
607
+ | multilingual | For multilingual tokenizers |
608
+ | optimum | For running Intel OpenVINO models |
609
+ | promptsource | For using PromptSource prompts |
610
+ | sentencepiece | For using the sentencepiece tokenizer |
611
+ | sparseml | For using NM's SparseML models |
612
+ | testing | For running library test suite |
613
+ | vllm | For loading models with vLLM |
614
+ | zeno | For visualizing results with Zeno |
615
+ | --------------- | --------------------------------------- |
616
+ | all | Loads all extras (not recommended) |
617
+
618
+ ## Cite as
619
+
620
+ ```
621
+ @misc{eval-harness,
622
+ author = {Gao, Leo and Tow, Jonathan and Abbasi, Baber and Biderman, Stella and Black, Sid and DiPofi, Anthony and Foster, Charles and Golding, Laurence and Hsu, Jeffrey and Le Noac'h, Alain and Li, Haonan and McDonell, Kyle and Muennighoff, Niklas and Ociepa, Chris and Phang, Jason and Reynolds, Laria and Schoelkopf, Hailey and Skowron, Aviya and Sutawika, Lintang and Tang, Eric and Thite, Anish and Wang, Ben and Wang, Kevin and Zou, Andy},
623
+ title = {A framework for few-shot language model evaluation},
624
+ month = 07,
625
+ year = 2024,
626
+ publisher = {Zenodo},
627
+ version = {v0.4.3},
628
+ doi = {10.5281/zenodo.12608602},
629
+ url = {https://zenodo.org/records/12608602}
630
+ }
631
+ ```
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval.egg-info/SOURCES.txt ADDED
The diff for this file is too large to render. See raw diff
 
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval.egg-info/entry_points.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [console_scripts]
2
+ lm-eval = lm_eval.__main__:cli_evaluate
3
+ lm_eval = lm_eval.__main__:cli_evaluate
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval.egg-info/requires.txt ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ accelerate>=0.26.0
2
+ evaluate
3
+ datasets>=2.16.0
4
+ evaluate>=0.4.0
5
+ jsonlines
6
+ numexpr
7
+ peft>=0.2.0
8
+ pybind11>=2.6.2
9
+ pytablewriter
10
+ rouge-score>=0.0.4
11
+ sacrebleu>=1.5.0
12
+ scikit-learn>=0.24.1
13
+ sqlitedict
14
+ torch>=1.8
15
+ tqdm-multiprocess
16
+ transformers>=4.1
17
+ zstandard
18
+ dill
19
+ word2number
20
+ more_itertools
21
+
22
+ [all]
23
+ lm_eval[anthropic]
24
+ lm_eval[dev]
25
+ lm_eval[deepsparse]
26
+ lm_eval[gptq]
27
+ lm_eval[hf_transfer]
28
+ lm_eval[ibm_watsonx_ai]
29
+ lm_eval[ifeval]
30
+ lm_eval[mamba]
31
+ lm_eval[math]
32
+ lm_eval[multilingual]
33
+ lm_eval[openai]
34
+ lm_eval[promptsource]
35
+ lm_eval[sentencepiece]
36
+ lm_eval[sparseml]
37
+ lm_eval[testing]
38
+ lm_eval[vllm]
39
+ lm_eval[zeno]
40
+ lm_eval[wandb]
41
+ lm_eval[japanese_leaderboard]
42
+
43
+ [api]
44
+ requests
45
+ aiohttp
46
+ tenacity
47
+ tqdm
48
+ tiktoken
49
+
50
+ [awq]
51
+ auto-awq>=0.2.6
52
+
53
+ [deepsparse]
54
+ deepsparse-nightly[llm]>=1.8.0.20240404
55
+
56
+ [dev]
57
+ pytest
58
+ pytest-cov
59
+ pytest-xdist
60
+ pre-commit
61
+ mypy
62
+
63
+ [gptq]
64
+ auto-gptq[triton]>=0.6.0
65
+
66
+ [gptqmodel]
67
+ gptqmodel>=1.0.9
68
+
69
+ [hf_transfer]
70
+ hf_transfer
71
+
72
+ [hqq]
73
+ hqq>=0.2.1
74
+
75
+ [ibm_watsonx_ai]
76
+ ibm_watsonx_ai>=1.1.22
77
+
78
+ [ifeval]
79
+ langdetect
80
+ immutabledict
81
+ nltk>=3.9.1
82
+
83
+ [japanese_leaderboard]
84
+ emoji==2.14.0
85
+ neologdn==0.5.3
86
+ fugashi[unidic-lite]
87
+ rouge_score>=0.1.2
88
+
89
+ [mamba]
90
+ mamba_ssm
91
+ causal-conv1d==1.0.2
92
+
93
+ [math]
94
+ sympy>=1.12
95
+ antlr4-python3-runtime==4.11
96
+
97
+ [multilingual]
98
+ nagisa>=0.2.7
99
+ jieba>=0.42.1
100
+ pycountry
101
+
102
+ [neuronx]
103
+ optimum[neuronx]
104
+
105
+ [optimum]
106
+ optimum[openvino]
107
+
108
+ [promptsource]
109
+ promptsource>=0.2.3
110
+
111
+ [sentencepiece]
112
+ sentencepiece>=0.1.98
113
+
114
+ [sparseml]
115
+ sparseml-nightly[llm]>=1.8.0.20240404
116
+
117
+ [testing]
118
+ pytest
119
+ pytest-cov
120
+ pytest-xdist
121
+
122
+ [vllm]
123
+ vllm>=0.4.2
124
+
125
+ [wandb]
126
+ wandb>=0.16.3
127
+ pandas
128
+ numpy
129
+
130
+ [zeno]
131
+ pandas
132
+ zeno-client
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval.egg-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ lm_eval
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/unitxt/dbpedia_14.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ task: dbpedia_14
2
+ include: unitxt
3
+ recipe: card=cards.dbpedia_14,template=templates.classification.multi_class.title
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/unitxt/law_stack_exchange.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ task: law_stack_exchange
2
+ include: unitxt
3
+ recipe: card=cards.law_stack_exchange,template=templates.classification.multi_class.title
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/unitxt/yahoo_answers_topics.yaml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ task: yahoo_answers_topics
2
+ include: unitxt
3
+ recipe: card=cards.yahoo_answers_topics,template=templates.classification.multi_class.title
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/unscramble/README.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Unscramble
2
+
3
+ ### Paper
4
+
5
+ Language Models are Few-Shot Learners
6
+ https://arxiv.org/pdf/2005.14165.pdf
7
+
8
+ Unscramble is a small battery of 5 “character manipulation” tasks. Each task
9
+ involves giving the model a word distorted by some combination of scrambling,
10
+ addition, or deletion of characters, and asking it to recover the original word.
11
+
12
+ Homepage: https://github.com/openai/gpt-3/tree/master/data
13
+
14
+
15
+ ### Citation
16
+
17
+ ```
18
+ @inproceedings{NEURIPS2020_1457c0d6,
19
+ author = {Brown, Tom and Mann, Benjamin and Ryder, Nick and Subbiah, Melanie and Kaplan, Jared D and Dhariwal, Prafulla and Neelakantan, Arvind and Shyam, Pranav and Sastry, Girish and Askell, Amanda and Agarwal, Sandhini and Herbert-Voss, Ariel and Krueger, Gretchen and Henighan, Tom and Child, Rewon and Ramesh, Aditya and Ziegler, Daniel and Wu, Jeffrey and Winter, Clemens and Hesse, Chris and Chen, Mark and Sigler, Eric and Litwin, Mateusz and Gray, Scott and Chess, Benjamin and Clark, Jack and Berner, Christopher and McCandlish, Sam and Radford, Alec and Sutskever, Ilya and Amodei, Dario},
20
+ booktitle = {Advances in Neural Information Processing Systems},
21
+ editor = {H. Larochelle and M. Ranzato and R. Hadsell and M. F. Balcan and H. Lin},
22
+ pages = {1877--1901},
23
+ publisher = {Curran Associates, Inc.},
24
+ title = {Language Models are Few-Shot Learners},
25
+ url = {https://proceedings.neurips.cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf},
26
+ volume = {33},
27
+ year = {2020}
28
+ }
29
+ ```
30
+
31
+ ### Groups and Tasks
32
+
33
+ #### Groups
34
+
35
+ * `unscramble`
36
+
37
+ #### Tasks
38
+
39
+ * `anagrams1` - Anagrams of all but the first and last letter.
40
+ * `anagrams2` - Anagrams of all but the first and last 2 letters.
41
+ * `cycle_letters` - Cycle letters in a word.
42
+ * `random_insertion` - Random insertions in the word that must be removed.
43
+ * `reversed_words` - Words spelled backwards that must be reversed.
44
+
45
+ ### Checklist
46
+
47
+ For adding novel benchmarks/datasets to the library:
48
+ * [x] Is the task an existing benchmark in the literature?
49
+ * [x] Have you referenced the original paper that introduced the task?
50
+ * [x] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
51
+
52
+
53
+ If other tasks on this dataset are already supported:
54
+ * [x] Is the "Main" variant of this task clearly denoted?
55
+ * [x] Have you provided a short sentence in a README on what each new variant adds / evaluates?
56
+ * [x] Have you noted which, if any, published evaluation setups are matched by this variant?
57
+ * [x] Checked for equivalence with v0.3.0 LM Evaluation Harness
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/unscramble/anagrams1.yaml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag:
2
+ - unscramble
3
+ task: anagrams1
4
+ dataset_path: EleutherAI/unscramble
5
+ dataset_name: mid_word_1_anagrams
6
+ output_type: generate_until
7
+ test_split: validation
8
+ doc_to_text: "{{context}}"
9
+ doc_to_target: "{{completion}}"
10
+ generation_kwargs:
11
+ until:
12
+ - "\n"
13
+ metric_list:
14
+ - metric: exact_match
15
+ aggregation: mean
16
+ higher_is_better: true
17
+ ignore_case: false
18
+ ignore_punctuation: false
19
+ metadata:
20
+ version: 2.0
21
+ dataset_kwargs:
22
+ trust_remote_code: true
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/webqs/utils.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Dict, List
2
+
3
+
4
+ def doc_to_choice(doc: Dict) -> List[str]:
5
+ """Return all of the accepted answers as choices."""
6
+ return _remove_prefixes(doc["answers"])
7
+
8
+
9
+ def doc_to_target(doc: Dict) -> List[int]:
10
+ """Return list of indices of accepted answers (all of them)."""
11
+ remaining = _remove_prefixes(doc["answers"])
12
+ return list(range(len(remaining)))
13
+
14
+
15
+ def _remove_prefixes(aliases):
16
+ """
17
+ Remove any alias that has a strict prefix elsewhere in the list.
18
+
19
+ This is an optimization. We can do this because if the prefix is acceptable by isgreedy,
20
+ we can stop looking.
21
+ """
22
+ aliases.sort()
23
+ ret = [aliases[0]]
24
+ for alias in aliases[1:]:
25
+ if not alias.startswith(ret[-1]):
26
+ ret.append(alias)
27
+ return ret
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/webqs/webqs.yaml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag:
2
+ - freebase
3
+ task: webqs
4
+ dataset_path: web_questions
5
+ dataset_name: null
6
+ output_type: multiple_choice
7
+ training_split: train
8
+ validation_split: null
9
+ test_split: test
10
+ doc_to_text: "Question: {{question}}\nAnswer:"
11
+ doc_to_target: !function utils.doc_to_target
12
+ doc_to_choice: !function utils.doc_to_choice
13
+ should_decontaminate: true
14
+ doc_to_decontamination_query: question
15
+ metric_list:
16
+ - metric: exact_match
17
+ aggregation: mean
18
+ higher_is_better: true
19
+ metadata:
20
+ version: 2.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmdp/README.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WMDP
2
+
3
+ ### Paper
4
+
5
+ Title: `The WMDP Benchmark: Measuring and Reducing Malicious Use With Unlearning`
6
+
7
+ Abstract: `https://arxiv.org/abs/2403.03218`
8
+
9
+ `The Weapons of Mass Destruction Proxy (WMDP) benchmark is a dataset of 4,157 multiple-choice questions surrounding hazardous knowledge in biosecurity cybersecurity, and chemical security. WMDP serves as both a proxy evaluation for hazardous knowledge in large language models (LLMs) and a benchmark for unlearning methods to remove such knowledge.`
10
+
11
+ Homepage: https://wmdp.ai
12
+
13
+
14
+ ### Citation
15
+
16
+ ```
17
+ @misc{li2024wmdp,
18
+ title={The WMDP Benchmark: Measuring and Reducing Malicious Use With Unlearning},
19
+ author={Nathaniel Li and Alexander Pan and Anjali Gopal and Summer Yue and Daniel Berrios and Alice Gatti and Justin D. Li and Ann-Kathrin Dombrowski and Shashwat Goel and Long Phan and Gabriel Mukobi and Nathan Helm-Burger and Rassin Lababidi and Lennart Justen and Andrew B. Liu and Michael Chen and Isabelle Barrass and Oliver Zhang and Xiaoyuan Zhu and Rishub Tamirisa and Bhrugu Bharathi and Adam Khoja and Zhenqi Zhao and Ariel Herbert-Voss and Cort B. Breuer and Andy Zou and Mantas Mazeika and Zifan Wang and Palash Oswal and Weiran Liu and Adam A. Hunt and Justin Tienken-Harder and Kevin Y. Shih and Kemper Talley and John Guan and Russell Kaplan and Ian Steneker and David Campbell and Brad Jokubaitis and Alex Levinson and Jean Wang and William Qian and Kallol Krishna Karmakar and Steven Basart and Stephen Fitz and Mindy Levine and Ponnurangam Kumaraguru and Uday Tupakula and Vijay Varadharajan and Yan Shoshitaishvili and Jimmy Ba and Kevin M. Esvelt and Alexandr Wang and Dan Hendrycks},
20
+ year={2024},
21
+ eprint={2403.03218},
22
+ archivePrefix={arXiv},
23
+ primaryClass={cs.LG}
24
+ }
25
+ ```
26
+
27
+ ### Groups, Tags, and Tasks
28
+
29
+ #### Groups
30
+
31
+ * `wmdp`: All 4,157 multiple-choice questions in biosecurity, cybersecurity, and chemical security
32
+
33
+ #### Tasks
34
+
35
+ * `wmdp_bio`: 1,520 multiple-choice questions in biosecurity
36
+ * `wmdp_cyber`: 2,225 multiple-choice questions in cybersecurity
37
+ * `wmdp_chemistry`: 412 multiple-choice questions in chemical security
38
+
39
+ ### Checklist
40
+
41
+ For adding novel benchmarks/datasets to the library:
42
+ * [x] Is the task an existing benchmark in the literature?
43
+ * [x] Have you referenced the original paper that introduced the task?
44
+ * [x] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
45
+
46
+
47
+ If other tasks on this dataset are already supported:
48
+ * [ ] Is the "Main" variant of this task clearly denoted?
49
+ * [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates?
50
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmdp/_default_template_yaml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dataset_path: cais/wmdp
2
+ test_split: test
3
+ training_split: null
4
+ validation_split: null
5
+ num_fewshot: 0
6
+ output_type: multiple_choice
7
+ doc_to_text: "{{question.strip()}}\nA. {{choices[0]}}\nB. {{choices[1]}}\nC. {{choices[2]}}\nD. {{choices[3]}}\nAnswer:"
8
+ doc_to_choice: ["A", "B", "C", "D"]
9
+ doc_to_target: answer
10
+ metric_list:
11
+ - metric: acc
12
+ aggregation: mean
13
+ higher_is_better: true
14
+ metadata:
15
+ version: 1
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmdp/wmdp_bio.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ "task": "wmdp_bio"
2
+ "dataset_name": "wmdp-bio"
3
+ "include": "_default_template_yaml"
4
+ "description": "The following are multiple choice questions (with answers) about biology.\n\n"
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmdp/wmdp_chem.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ "task": "wmdp_chem"
2
+ "dataset_name": "wmdp-chem"
3
+ "include": "_default_template_yaml"
4
+ "description": "The following are multiple choice questions (with answers) about chemistry.\n\n"
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmt2016/README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WMT16
2
+
3
+ ### Paper
4
+
5
+ Title: `Findings of the 2016 Conference on Machine Translation`
6
+ Abstract: http://www.aclweb.org/anthology/W/W16/W16-2301
7
+
8
+
9
+
10
+ Homepage: https://huggingface.co/datasets/wmt16
11
+
12
+
13
+ ### Citation
14
+
15
+ ```
16
+ @InProceedings{bojar-EtAl:2016:WMT1,
17
+ author = {Bojar, Ond
18
+ {r}ej and Chatterjee, Rajen and Federmann, Christian and Graham, Yvette and Haddow, Barry and Huck, Matthias and Jimeno Yepes, Antonio and Koehn, Philipp and Logacheva, Varvara and Monz, Christof and Negri, Matteo and Neveol, Aurelie and Neves, Mariana and Popel, Martin and Post, Matt and Rubino, Raphael and Scarton, Carolina and Specia, Lucia and Turchi, Marco and Verspoor, Karin and Zampieri, Marcos},
19
+ title = {Findings of the 2016 Conference on Machine Translation},
20
+ booktitle = {Proceedings of the First Conference on Machine Translation},
21
+ month = {August},
22
+ year = {2016},
23
+ address = {Berlin, Germany},
24
+ publisher = {Association for Computational Linguistics},
25
+ pages = {131--198},
26
+ url = {http://www.aclweb.org/anthology/W/W16/W16-2301}
27
+ }
28
+ ```
29
+
30
+ ### Groups, Tags, and Tasks
31
+
32
+ #### Tasks
33
+
34
+ With specific prompt styles
35
+ * `wmt-ro-en-t5-prompt`: WMT16 with the prompt template used for T5
36
+
37
+
38
+ ### Checklist
39
+
40
+ For adding novel benchmarks/datasets to the library:
41
+ * [ ] Is the task an existing benchmark in the literature?
42
+ * [ ] Have you referenced the original paper that introduced the task?
43
+ * [ ] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
44
+
45
+
46
+ If other tasks on this dataset are already supported:
47
+ * [ ] Is the "Main" variant of this task clearly denoted?
48
+ * [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates?
49
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wmt2016/metrics.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import evaluate
2
+
3
+
4
+ def bleu(predictions, references):
5
+ return (predictions[0], references[0])
6
+
7
+
8
+ def agg_bleu(items):
9
+ bleu_fn = evaluate.load("bleu")
10
+ predictions, references = zip(*items)
11
+ return bleu_fn.compute(predictions=predictions, references=references)["bleu"]
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wsc273/README.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WSC273
2
+
3
+ ### Paper
4
+
5
+ Title: `The Winograd Schema Challenge`
6
+
7
+ Abstract: http://commonsensereasoning.org/2011/papers/Levesque.pdf
8
+
9
+ A Winograd schema is a pair of sentences that differ in only one or two words
10
+ and that contain an ambiguity that is resolved in opposite ways in the two
11
+ sentences and requires the use of world knowledge and reasoning for its resolution.
12
+ The Winograd Schema Challenge 273 is a collection of 273 such Winograd schemas.
13
+
14
+ NOTE: This evaluation of Winograd Schema Challenge is based on `partial evaluation`
15
+ as described by Trinh & Le in Simple Method for Commonsense Reasoning (2018).
16
+ See: https://arxiv.org/abs/1806.0
17
+
18
+ Homepage: https://cs.nyu.edu/~davise/papers/WinogradSchemas/WS.html
19
+
20
+
21
+ ### Citation
22
+
23
+ ```
24
+ @inproceedings{ea01b9c0db064caca6986b925d75f2bb,
25
+ title = "The winograd schema challenge",
26
+ abstract = "In this paper, we present an alternative to the Turing Test that has some conceptual and practical advantages. A Wino-grad schema is a pair of sentences that differ only in one or two words and that contain a referential ambiguity that is resolved in opposite directions in the two sentences. We have compiled a collection of Winograd schemas, designed so that the correct answer is obvious to the human reader, but cannot easily be found using selectional restrictions or statistical techniques over text corpora. A contestant in the Winograd Schema Challenge is presented with a collection of one sentence from each pair, and required to achieve human-level accuracy in choosing the correct disambiguation.",
27
+ author = "Levesque, {Hector J.} and Ernest Davis and Leora Morgenstern",
28
+ year = "2012",
29
+ language = "English (US)",
30
+ isbn = "9781577355601",
31
+ series = "Proceedings of the International Conference on Knowledge Representation and Reasoning",
32
+ publisher = "Institute of Electrical and Electronics Engineers Inc.",
33
+ pages = "552--561",
34
+ booktitle = "13th International Conference on the Principles of Knowledge Representation and Reasoning, KR 2012",
35
+ note = "13th International Conference on the Principles of Knowledge Representation and Reasoning, KR 2012 ; Conference date: 10-06-2012 Through 14-06-2012",
36
+ }
37
+ ```
38
+
39
+ ### Groups and Tasks
40
+
41
+ #### Groups
42
+
43
+ * Not part of any group yet.
44
+
45
+ #### Tasks
46
+
47
+ * `wsc273`
48
+
49
+ ### Checklist
50
+
51
+ For adding novel benchmarks/datasets to the library:
52
+ * [ ] Is the task an existing benchmark in the literature?
53
+ * [ ] Have you referenced the original paper that introduced the task?
54
+ * [ ] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
55
+
56
+
57
+ If other tasks on this dataset are already supported:
58
+ * [ ] Is the "Main" variant of this task clearly denoted?
59
+ * [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates?
60
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/wsc273/utils.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ upper_pronouns = [
2
+ "A",
3
+ "An",
4
+ "The",
5
+ "She",
6
+ "He",
7
+ "It",
8
+ "They",
9
+ "My",
10
+ "His",
11
+ "Her",
12
+ "Their",
13
+ ]
14
+
15
+
16
+ def process_doc(dataset):
17
+ def process_fn(doc):
18
+ # The HF implementation of `wsc273` is not `partial evaluation` friendly.
19
+ doc["text"] = doc["text"].replace(" ", " ")
20
+ doc["options"][0] = __normalize_option(doc, doc["options"][0])
21
+ doc["options"][1] = __normalize_option(doc, doc["options"][1])
22
+ return doc
23
+
24
+ return dataset.map(process_fn)
25
+
26
+
27
+ def __normalize_option(doc, option):
28
+ # Append `'s` to possessive determiner based options.
29
+ if doc["pronoun"].lower() in ["my", "his", "her", "our", "their"]:
30
+ option += "'s"
31
+ # Appropriately lowercase the pronoun in the option.
32
+ pronoun = option.split()[0]
33
+ start_of_sentence = doc["text"][doc["pronoun_loc"] - 2] == "."
34
+ if not start_of_sentence and pronoun in upper_pronouns:
35
+ return option.replace(pronoun, pronoun.lower())
36
+ return option
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/README.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # XCOPA
2
+
3
+ ### Paper
4
+
5
+ Title: `XCOPA: A Multilingual Dataset for Causal Commonsense Reasoning`
6
+
7
+ Abstract: https://ducdauge.github.io/files/xcopa.pdf
8
+
9
+ The Cross-lingual Choice of Plausible Alternatives dataset is a benchmark to evaluate the ability of machine learning models to transfer commonsense reasoning across languages.
10
+ The dataset is the translation and reannotation of the English COPA (Roemmele et al. 2011) and covers 11 languages from 11 families and several areas around the globe.
11
+ The dataset is challenging as it requires both the command of world knowledge and the ability to generalise to new languages.
12
+ All the details about the creation of XCOPA and the implementation of the baselines are available in the paper.
13
+
14
+ Homepage: https://github.com/cambridgeltl/xcopa
15
+
16
+ ### Citation
17
+
18
+ ```
19
+ @inproceedings{ponti2020xcopa,
20
+ title={{XCOPA: A} Multilingual Dataset for Causal Commonsense Reasoning},
21
+ author={Edoardo M. Ponti, Goran Glava\v{s}, Olga Majewska, Qianchu Liu, Ivan Vuli\'{c} and Anna Korhonen},
22
+ booktitle={Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
23
+ year={2020},
24
+ url={https://ducdauge.github.io/files/xcopa.pdf}
25
+ }
26
+ ```
27
+
28
+ ### Groups and Tasks
29
+
30
+ #### Groups
31
+
32
+ * `xcopa`
33
+
34
+ #### Tasks
35
+
36
+ * `xcopa_et`: Estonian
37
+ * `xcopa_ht`: Haitian Creole
38
+ * `xcopa_id`: Indonesian
39
+ * `xcopa_it`: Italian
40
+ * `xcopa_qu`: Cusco-Collao Quechua
41
+ * `xcopa_sw`: Kiswahili
42
+ * `xcopa_ta`: Tamil
43
+ * `xcopa_th`: Thai
44
+ * `xcopa_tr`: Turkish
45
+ * `xcopa_vi`: Vietnamese
46
+ * `xcopa_zh`: Mandarin Chinese
47
+
48
+
49
+ ### Checklist
50
+
51
+ For adding novel benchmarks/datasets to the library:
52
+ * [ ] Is the task an existing benchmark in the literature?
53
+ * [ ] Have you referenced the original paper that introduced the task?
54
+ * [ ] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
55
+
56
+
57
+ If other tasks on this dataset are already supported:
58
+ * [ ] Is the "Main" variant of this task clearly denoted?
59
+ * [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates?
60
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/_xcopa.yaml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ group: xcopa
2
+ task:
3
+ - xcopa_et
4
+ - xcopa_ht
5
+ - xcopa_id
6
+ - xcopa_it
7
+ - xcopa_qu
8
+ - xcopa_sw
9
+ - xcopa_ta
10
+ - xcopa_th
11
+ - xcopa_tr
12
+ - xcopa_vi
13
+ - xcopa_zh
14
+ aggregate_metric_list:
15
+ - metric: acc
16
+ aggregation: mean
17
+ weight_by_size: True
18
+ metadata:
19
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_et.yaml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task: xcopa_et
2
+ dataset_path: xcopa
3
+ dataset_name: et
4
+ output_type: multiple_choice
5
+ validation_split: validation
6
+ test_split: test
7
+ doc_to_text: !function utils.doc_to_text_et
8
+ doc_to_target: label
9
+ doc_to_choice: !function utils.doc_to_choice
10
+ metric_list:
11
+ - metric: acc
12
+ metadata:
13
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_ht.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ include: default_et.yaml
2
+ task: xcopa_ht
3
+ dataset_name: ht
4
+ doc_to_text: !function utils.doc_to_text_ht
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_id.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ include: default_et.yaml
2
+ task: xcopa_id
3
+ dataset_name: id
4
+ doc_to_text: !function utils.doc_to_text_id
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_it.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ include: default_et.yaml
2
+ task: xcopa_it
3
+ dataset_name: it
4
+ doc_to_text: !function utils.doc_to_text_it
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_qu.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ include: default_et.yaml
2
+ task: xcopa_qu
3
+ dataset_name: qu
4
+ doc_to_text: !function utils.doc_to_text_qu
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_sw.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ include: default_et.yaml
2
+ task: xcopa_sw
3
+ dataset_name: sw
4
+ doc_to_text: !function utils.doc_to_text_sw
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_ta.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ include: default_et.yaml
2
+ task: xcopa_ta
3
+ dataset_name: ta
4
+ doc_to_text: !function utils.doc_to_text_ta
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_tr.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ include: default_et.yaml
2
+ task: xcopa_tr
3
+ dataset_name: tr
4
+ doc_to_text: !function utils.doc_to_text_tr
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_vi.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ include: default_et.yaml
2
+ task: xcopa_vi
3
+ dataset_name: vi
4
+ doc_to_text: !function utils.doc_to_text_vi
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/default_zh.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ include: default_et.yaml
2
+ task: xcopa_zh
3
+ dataset_name: zh
4
+ doc_to_text: !function utils.doc_to_text_zh
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xcopa/utils.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from functools import partial
2
+
3
+
4
+ def convert_choice(choice):
5
+ return choice[0].lower() + choice[1:]
6
+
7
+
8
+ def doc_to_text(doc, connector):
9
+ # Drop the period
10
+ conn = connector[doc["question"]]
11
+ return doc["premise"].strip()[:-1] + f" {conn}"
12
+
13
+
14
+ def doc_to_choice(doc):
15
+ return [convert_choice(doc["choice1"]), convert_choice(doc["choice2"])]
16
+
17
+
18
+ doc_to_text_et = partial(
19
+ doc_to_text,
20
+ connector={
21
+ "cause": "sest",
22
+ "effect": "seetõttu",
23
+ },
24
+ )
25
+
26
+
27
+ doc_to_text_ht = partial(
28
+ doc_to_text,
29
+ connector={
30
+ "cause": "poukisa",
31
+ "effect": "donk sa",
32
+ },
33
+ )
34
+
35
+
36
+ doc_to_text_it = partial(
37
+ doc_to_text,
38
+ connector={
39
+ "cause": "perché",
40
+ "effect": "quindi",
41
+ },
42
+ )
43
+
44
+
45
+ doc_to_text_id = partial(
46
+ doc_to_text,
47
+ connector={
48
+ "cause": "karena",
49
+ "effect": "maka",
50
+ },
51
+ )
52
+
53
+
54
+ doc_to_text_qu = partial(
55
+ doc_to_text,
56
+ connector={
57
+ "cause": "imataq",
58
+ "effect": "chaymi",
59
+ },
60
+ )
61
+
62
+
63
+ doc_to_text_sw = partial(
64
+ doc_to_text,
65
+ connector={
66
+ "cause": "kwa sababu",
67
+ "effect": "kwa hiyo",
68
+ },
69
+ )
70
+
71
+
72
+ doc_to_text_zh = partial(
73
+ doc_to_text,
74
+ connector={
75
+ "cause": "因为",
76
+ "effect": "所以",
77
+ },
78
+ )
79
+
80
+
81
+ doc_to_text_ta = partial(
82
+ doc_to_text,
83
+ connector={
84
+ "cause": "காரணமாக",
85
+ "effect": "எனவே",
86
+ },
87
+ )
88
+
89
+
90
+ doc_to_text_th = partial(
91
+ doc_to_text,
92
+ connector={
93
+ "cause": "เพราะ",
94
+ "effect": "ดังนั้น",
95
+ },
96
+ )
97
+
98
+
99
+ doc_to_text_tr = partial(
100
+ doc_to_text,
101
+ connector={
102
+ "cause": "çünkü",
103
+ "effect": "bu yüzden",
104
+ },
105
+ )
106
+
107
+
108
+ doc_to_text_vi = partial(
109
+ doc_to_text,
110
+ connector={
111
+ "cause": "bởi vì",
112
+ "effect": "vì vậy",
113
+ },
114
+ )
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/README.md ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # XNLI
2
+
3
+ ### Paper
4
+
5
+ Title: `XNLI: Evaluating Cross-lingual Sentence Representations`
6
+
7
+ Abstract: https://arxiv.org/abs/1809.05053
8
+
9
+ Based on the implementation of @yongzx (see https://github.com/EleutherAI/lm-evaluation-harness/pull/258)
10
+
11
+ Prompt format (same as XGLM and mGPT):
12
+
13
+ sentence1 + ", right? " + mask = (Yes|Also|No) + ", " + sentence2
14
+
15
+ Predicition is the full sequence with the highest likelihood.
16
+
17
+ Language specific prompts are translated word-by-word with Google Translate
18
+ and may differ from the ones used by mGPT and XGLM (they do not provide their prompts).
19
+
20
+ Homepage: https://github.com/facebookresearch/XNLI
21
+
22
+
23
+ ### Citation
24
+
25
+ """
26
+ @InProceedings{conneau2018xnli,
27
+ author = "Conneau, Alexis
28
+ and Rinott, Ruty
29
+ and Lample, Guillaume
30
+ and Williams, Adina
31
+ and Bowman, Samuel R.
32
+ and Schwenk, Holger
33
+ and Stoyanov, Veselin",
34
+ title = "XNLI: Evaluating Cross-lingual Sentence Representations",
35
+ booktitle = "Proceedings of the 2018 Conference on Empirical Methods
36
+ in Natural Language Processing",
37
+ year = "2018",
38
+ publisher = "Association for Computational Linguistics",
39
+ location = "Brussels, Belgium",
40
+ }
41
+ """
42
+
43
+ ### Groups and Tasks
44
+
45
+ #### Groups
46
+
47
+ * `xnli`
48
+
49
+ #### Tasks
50
+
51
+ * `xnli_ar`: Arabic
52
+ * `xnli_bg`: Bulgarian
53
+ * `xnli_de`: German
54
+ * `xnli_el`: Greek
55
+ * `xnli_en`: English
56
+ * `xnli_es`: Spanish
57
+ * `xnli_fr`: French
58
+ * `xnli_hi`: Hindi
59
+ * `xnli_ru`: Russian
60
+ * `xnli_sw`: Swahili
61
+ * `xnli_th`: Thai
62
+ * `xnli_tr`: Turkish
63
+ * `xnli_ur`: Urdu
64
+ * `xnli_vi`: Vietnamese
65
+ * `xnli_zh`: Chinese
66
+
67
+ ### Checklist
68
+
69
+ For adding novel benchmarks/datasets to the library:
70
+ * [ ] Is the task an existing benchmark in the literature?
71
+ * [ ] Have you referenced the original paper that introduced the task?
72
+ * [ ] If yes, does the original paper provide a reference implementation? If so, have you checked against the reference implementation and documented how to run such a test?
73
+
74
+
75
+ If other tasks on this dataset are already supported:
76
+ * [ ] Is the "Main" variant of this task clearly denoted?
77
+ * [ ] Have you provided a short sentence in a README on what each new variant adds / evaluates?
78
+ * [ ] Have you noted which, if any, published evaluation setups are matched by this variant?
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/_xnli.yaml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ group: xnli
2
+ task:
3
+ - xnli_ar
4
+ - xnli_bg
5
+ - xnli_de
6
+ - xnli_el
7
+ - xnli_en
8
+ - xnli_es
9
+ - xnli_fr
10
+ - xnli_hi
11
+ - xnli_ru
12
+ - xnli_sw
13
+ - xnli_th
14
+ - xnli_tr
15
+ - xnli_ur
16
+ - xnli_vi
17
+ - xnli_zh
18
+ aggregate_metric_list:
19
+ - metric: acc
20
+ aggregation: mean
21
+ weight_by_size: true
22
+ metadata:
23
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/utils.py ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+
3
+ import yaml
4
+
5
+
6
+ # Different languages that are part of xnli.
7
+ # These correspond to dataset names (Subsets) on HuggingFace.
8
+ # A yaml file is generated by this script for each language.
9
+
10
+ LANGUAGES = {
11
+ "ar": { # Arabic
12
+ "QUESTION_WORD": "صحيح",
13
+ "ENTAILMENT_LABEL": "نعم",
14
+ "NEUTRAL_LABEL": "لذا",
15
+ "CONTRADICTION_LABEL": "رقم",
16
+ },
17
+ "bg": { # Bulgarian
18
+ "QUESTION_WORD": "правилно",
19
+ "ENTAILMENT_LABEL": "да",
20
+ "NEUTRAL_LABEL": "така",
21
+ "CONTRADICTION_LABEL": "не",
22
+ },
23
+ "de": { # German
24
+ "QUESTION_WORD": "richtig",
25
+ "ENTAILMENT_LABEL": "Ja",
26
+ "NEUTRAL_LABEL": "Auch",
27
+ "CONTRADICTION_LABEL": "Nein",
28
+ },
29
+ "el": { # Greek
30
+ "QUESTION_WORD": "σωστός",
31
+ "ENTAILMENT_LABEL": "Ναί",
32
+ "NEUTRAL_LABEL": "Έτσι",
33
+ "CONTRADICTION_LABEL": "όχι",
34
+ },
35
+ "en": { # English
36
+ "QUESTION_WORD": "right",
37
+ "ENTAILMENT_LABEL": "Yes",
38
+ "NEUTRAL_LABEL": "Also",
39
+ "CONTRADICTION_LABEL": "No",
40
+ },
41
+ "es": { # Spanish
42
+ "QUESTION_WORD": "correcto",
43
+ "ENTAILMENT_LABEL": "Sí",
44
+ "NEUTRAL_LABEL": "Asi que",
45
+ "CONTRADICTION_LABEL": "No",
46
+ },
47
+ "fr": { # French
48
+ "QUESTION_WORD": "correct",
49
+ "ENTAILMENT_LABEL": "Oui",
50
+ "NEUTRAL_LABEL": "Aussi",
51
+ "CONTRADICTION_LABEL": "Non",
52
+ },
53
+ "hi": { # Hindi
54
+ "QUESTION_WORD": "सही",
55
+ "ENTAILMENT_LABEL": "हाँ",
56
+ "NEUTRAL_LABEL": "इसलिए",
57
+ "CONTRADICTION_LABEL": "नहीं",
58
+ },
59
+ "ru": { # Russian
60
+ "QUESTION_WORD": "правильно",
61
+ "ENTAILMENT_LABEL": "Да",
62
+ "NEUTRAL_LABEL": "Так",
63
+ "CONTRADICTION_LABEL": "Нет",
64
+ },
65
+ "sw": { # Swahili
66
+ "QUESTION_WORD": "sahihi",
67
+ "ENTAILMENT_LABEL": "Ndiyo",
68
+ "NEUTRAL_LABEL": "Hivyo",
69
+ "CONTRADICTION_LABEL": "Hapana",
70
+ },
71
+ "th": { # Thai
72
+ "QUESTION_WORD": "ถูกต้อง",
73
+ "ENTAILMENT_LABEL": "ใช่",
74
+ "NEUTRAL_LABEL": "ดังนั้น",
75
+ "CONTRADICTION_LABEL": "ไม่",
76
+ },
77
+ "tr": { # Turkish
78
+ "QUESTION_WORD": "doğru",
79
+ "ENTAILMENT_LABEL": "Evet",
80
+ "NEUTRAL_LABEL": "Böylece",
81
+ "CONTRADICTION_LABEL": "Hayır",
82
+ },
83
+ "ur": { # Urdu
84
+ "QUESTION_WORD": "صحیح",
85
+ "ENTAILMENT_LABEL": "جی ہاں",
86
+ "NEUTRAL_LABEL": "اس لئے",
87
+ "CONTRADICTION_LABEL": "نہیں",
88
+ },
89
+ "vi": { # Vietnamese
90
+ "QUESTION_WORD": "đúng",
91
+ "ENTAILMENT_LABEL": "Vâng",
92
+ "NEUTRAL_LABEL": "Vì vậy",
93
+ "CONTRADICTION_LABEL": "Không",
94
+ },
95
+ "zh": { # Chinese
96
+ "QUESTION_WORD": "正确",
97
+ "ENTAILMENT_LABEL": "是的",
98
+ "NEUTRAL_LABEL": "所以",
99
+ "CONTRADICTION_LABEL": "不是的",
100
+ },
101
+ }
102
+
103
+
104
+ def gen_lang_yamls(output_dir: str, overwrite: bool) -> None:
105
+ """
106
+ Generate a yaml file for each language.
107
+
108
+ :param output_dir: The directory to output the files to.
109
+ :param overwrite: Whether to overwrite files if they already exist.
110
+ """
111
+ err = []
112
+ for lang in LANGUAGES.keys():
113
+ file_name = f"xnli_{lang}.yaml"
114
+ try:
115
+ QUESTION_WORD = LANGUAGES[lang]["QUESTION_WORD"]
116
+ ENTAILMENT_LABEL = LANGUAGES[lang]["ENTAILMENT_LABEL"]
117
+ NEUTRAL_LABEL = LANGUAGES[lang]["NEUTRAL_LABEL"]
118
+ CONTRADICTION_LABEL = LANGUAGES[lang]["CONTRADICTION_LABEL"]
119
+ with open(
120
+ f"{output_dir}/{file_name}", "w" if overwrite else "x", encoding="utf8"
121
+ ) as f:
122
+ f.write("# Generated by utils.py\n")
123
+ yaml.dump(
124
+ {
125
+ "include": "xnli_common_yaml",
126
+ "dataset_name": lang,
127
+ "task": f"xnli_{lang}",
128
+ "doc_to_text": "",
129
+ "doc_to_choice": f"{{{{["
130
+ f"""premise+\", {QUESTION_WORD}? {ENTAILMENT_LABEL}, \"+hypothesis,"""
131
+ f"""premise+\", {QUESTION_WORD}? {NEUTRAL_LABEL}, \"+hypothesis,"""
132
+ f"""premise+\", {QUESTION_WORD}? {CONTRADICTION_LABEL}, \"+hypothesis"""
133
+ f"]}}}}",
134
+ },
135
+ f,
136
+ allow_unicode=True,
137
+ )
138
+ except FileExistsError:
139
+ err.append(file_name)
140
+
141
+ if len(err) > 0:
142
+ raise FileExistsError(
143
+ "Files were not created because they already exist (use --overwrite flag):"
144
+ f" {', '.join(err)}"
145
+ )
146
+
147
+
148
+ def main() -> None:
149
+ """Parse CLI args and generate language-specific yaml files."""
150
+ parser = argparse.ArgumentParser()
151
+ parser.add_argument(
152
+ "--overwrite",
153
+ default=False,
154
+ action="store_true",
155
+ help="Overwrite files if they already exist",
156
+ )
157
+ parser.add_argument(
158
+ "--output-dir", default=".", help="Directory to write yaml files to"
159
+ )
160
+ args = parser.parse_args()
161
+
162
+ gen_lang_yamls(output_dir=args.output_dir, overwrite=args.overwrite)
163
+
164
+
165
+ if __name__ == "__main__":
166
+ main()
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_ar.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: ar
3
+ doc_to_choice: '{{[premise+", صحيح? نعم, "+hypothesis,premise+", صحيح? لذا, "+hypothesis,premise+",
4
+ صحيح? رقم, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_ar
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_bg.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: bg
3
+ doc_to_choice: '{{[premise+", правилно? да, "+hypothesis,premise+", правилно? така,
4
+ "+hypothesis,premise+", правилно? не, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_bg
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_common_yaml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file will be included in the generated language-specific task configs.
2
+ # It doesn't have a yaml file extension as it is not meant to be imported directly
3
+ # by the harness.
4
+ task: null
5
+ dataset_path: xnli
6
+ dataset_name: null
7
+ output_type: multiple_choice
8
+ training_split: train
9
+ validation_split: validation
10
+ doc_to_text: null
11
+ doc_to_target: label
12
+ doc_to_choice: null
13
+ metric_list:
14
+ - metric: acc
15
+ aggregation: mean
16
+ higher_is_better: true
17
+ metadata:
18
+ version: 1.0
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_de.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: de
3
+ doc_to_choice: '{{[premise+", richtig? Ja, "+hypothesis,premise+", richtig? Auch,
4
+ "+hypothesis,premise+", richtig? Nein, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_de
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_el.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: el
3
+ doc_to_choice: '{{[premise+", σωστός? Ναί, "+hypothesis,premise+", σωστός? Έτσι, "+hypothesis,premise+",
4
+ σωστός? όχι, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_el
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_en.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: en
3
+ doc_to_choice: '{{[premise+", right? Yes, "+hypothesis,premise+", right? Also, "+hypothesis,premise+",
4
+ right? No, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_en
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_es.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: es
3
+ doc_to_choice: '{{[premise+", correcto? Sí, "+hypothesis,premise+", correcto? Asi
4
+ que, "+hypothesis,premise+", correcto? No, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_es
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_fr.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: fr
3
+ doc_to_choice: '{{[premise+", correct? Oui, "+hypothesis,premise+", correct? Aussi,
4
+ "+hypothesis,premise+", correct? Non, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_fr
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_hi.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: hi
3
+ doc_to_choice: '{{[premise+", सही? हाँ, "+hypothesis,premise+", सही? इसलिए, "+hypothesis,premise+",
4
+ सही? नहीं, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_hi
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_ru.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: ru
3
+ doc_to_choice: '{{[premise+", правильно? Да, "+hypothesis,premise+", правильно? Так,
4
+ "+hypothesis,premise+", правильно? Нет, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_ru
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_sw.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: sw
3
+ doc_to_choice: '{{[premise+", sahihi? Ndiyo, "+hypothesis,premise+", sahihi? Hivyo,
4
+ "+hypothesis,premise+", sahihi? Hapana, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_sw
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_th.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: th
3
+ doc_to_choice: '{{[premise+", ถูกต้อง? ใช่, "+hypothesis,premise+", ถูกต้อง? ดังนั้น,
4
+ "+hypothesis,premise+", ถูกต้อง? ไม่, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_th
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_tr.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: tr
3
+ doc_to_choice: '{{[premise+", doğru? Evet, "+hypothesis,premise+", doğru? Böylece,
4
+ "+hypothesis,premise+", doğru? Hayır, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_tr
lm-quant-toolkit/.deps/lm-evaluation-harness/lm_eval/tasks/xnli/xnli_ur.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Generated by utils.py
2
+ dataset_name: ur
3
+ doc_to_choice: '{{[premise+", صحیح? جی ہاں, "+hypothesis,premise+", صحیح? اس لئے,
4
+ "+hypothesis,premise+", صحیح? نہیں, "+hypothesis]}}'
5
+ doc_to_text: ''
6
+ include: xnli_common_yaml
7
+ task: xnli_ur