Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- ckpts/universal/global_step40/zero/26.mlp.dense_h_to_4h_swiglu.weight/exp_avg.pt +3 -0
- ckpts/universal/global_step40/zero/26.mlp.dense_h_to_4h_swiglu.weight/exp_avg_sq.pt +3 -0
- lm-evaluation-harness/.coveragerc +28 -0
- lm-evaluation-harness/.deepspeed_env +156 -0
- lm-evaluation-harness/.pre-commit-config.yaml +54 -0
- lm-evaluation-harness/0 +0 -0
- lm-evaluation-harness/12 +0 -0
- lm-evaluation-harness/15 +0 -0
- lm-evaluation-harness/16 +0 -0
- lm-evaluation-harness/20 +0 -0
- lm-evaluation-harness/6 +0 -0
- lm-evaluation-harness/80 +0 -0
- lm-evaluation-harness/CODEOWNERS +1 -0
- lm-evaluation-harness/README.md +451 -0
- lm-evaluation-harness/ignore.txt +8 -0
- lm-evaluation-harness/mypy.ini +29 -0
- lm-evaluation-harness/pile_statistics.json +37 -0
- lm-evaluation-harness/pyproject.toml +107 -0
- lm-evaluation-harness/setup.py +5 -0
- venv/bin/Activate.ps1 +247 -0
- venv/bin/accelerate +8 -0
- venv/bin/accelerate-estimate-memory +8 -0
- venv/bin/activate.fish +69 -0
- venv/bin/convert-caffe2-to-onnx +8 -0
- venv/bin/convert-onnx-to-caffe2 +8 -0
- venv/bin/cpuinfo +8 -0
- venv/bin/datasets-cli +8 -0
- venv/bin/deepspeed +6 -0
- venv/bin/ds +6 -0
- venv/bin/ds_elastic +40 -0
- venv/bin/ds_ssh +34 -0
- venv/bin/dsr +6 -0
- venv/bin/evaluate-cli +8 -0
- venv/bin/f2py +8 -0
- venv/bin/get_gprof +75 -0
- venv/bin/get_objgraph +54 -0
- venv/bin/huggingface-cli +8 -0
- venv/bin/lm-eval +8 -0
- venv/bin/ninja +8 -0
- venv/bin/normalizer +8 -0
- venv/bin/pip3 +8 -0
- venv/bin/pip3.10 +8 -0
- venv/bin/pybind11-config +8 -0
- venv/bin/sacrebleu +8 -0
- venv/bin/tabulate +8 -0
- venv/lib/python3.10/site-packages/sympy/plotting/tests/test_region_not.png +3 -0
- venv/lib/python3.10/site-packages/torch/bin/protoc +3 -0
- venv/lib/python3.10/site-packages/torch/bin/protoc-3.13.0.0 +3 -0
- venv/lib/python3.10/site-packages/transformers/models/clipseg/__init__.py +71 -0
.gitattributes
CHANGED
@@ -145,3 +145,5 @@ venv/lib/python3.10/site-packages/scipy/special/cython_special.cpython-310-x86_6
|
|
145 |
venv/lib/python3.10/site-packages/scipy/optimize/_highs/_highs_wrapper.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
146 |
venv/lib/python3.10/site-packages/torch/lib/libc10.so filter=lfs diff=lfs merge=lfs -text
|
147 |
venv/lib/python3.10/site-packages/triton/third_party/cuda/bin/ptxas filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
145 |
venv/lib/python3.10/site-packages/scipy/optimize/_highs/_highs_wrapper.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
146 |
venv/lib/python3.10/site-packages/torch/lib/libc10.so filter=lfs diff=lfs merge=lfs -text
|
147 |
venv/lib/python3.10/site-packages/triton/third_party/cuda/bin/ptxas filter=lfs diff=lfs merge=lfs -text
|
148 |
+
venv/lib/python3.10/site-packages/torch/bin/protoc filter=lfs diff=lfs merge=lfs -text
|
149 |
+
venv/lib/python3.10/site-packages/torch/bin/protoc-3.13.0.0 filter=lfs diff=lfs merge=lfs -text
|
ckpts/universal/global_step40/zero/26.mlp.dense_h_to_4h_swiglu.weight/exp_avg.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2595a49f660f405ae2cf1def88895a7b80afbff32b49c01965d8b6a53e5a9a14
|
3 |
+
size 33555612
|
ckpts/universal/global_step40/zero/26.mlp.dense_h_to_4h_swiglu.weight/exp_avg_sq.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0917ac57edacad253440db77cfdfb154c8fc0ef992bb917234936ce76a1168de
|
3 |
+
size 33555627
|
lm-evaluation-harness/.coveragerc
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[run]
|
2 |
+
|
3 |
+
# tasks that aren't wired up.
|
4 |
+
omit =
|
5 |
+
lm_eval/tasks/quac.py
|
6 |
+
lm_eval/tasks/storycloze.py
|
7 |
+
lm_eval/tasks/cbt.py
|
8 |
+
lm_eval/tasks/sat.py
|
9 |
+
lm_eval/tasks/triviaqa.py
|
10 |
+
lm_eval/tasks/naturalqs.py
|
11 |
+
lm_eval/models/dummy.py
|
12 |
+
|
13 |
+
[report]
|
14 |
+
exclude_lines =
|
15 |
+
# Skip any pass lines such as may be used for @abstractmethod
|
16 |
+
pass
|
17 |
+
|
18 |
+
# Have to re-enable the standard pragma
|
19 |
+
pragma: no cover
|
20 |
+
|
21 |
+
# Don't complain about missing debug-only code:
|
22 |
+
def __repr__
|
23 |
+
if self\.debug
|
24 |
+
|
25 |
+
# Don't complain if tests don't hit defensive assertion code:
|
26 |
+
raise AssertionError
|
27 |
+
raise NotImplementedError
|
28 |
+
return NotImplemented
|
lm-evaluation-harness/.deepspeed_env
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
OMPI_MCA_btl_vader_single_copy_mechanism=none
|
2 |
+
GLIBCXX_FORCE_NEW=1
|
3 |
+
LIBOFI_VERSION=0.0.1
|
4 |
+
HOSTNAME=peacock-0
|
5 |
+
LANGUAGE=en_US.UTF-8
|
6 |
+
MPICC=/opt/amazon/openmpi/bin/mpicc
|
7 |
+
HABANA_LOGS=/var/log/habana_logs/
|
8 |
+
FI_EFA_USE_DEVICE_RDMA=1
|
9 |
+
RDMA_CORE_ROOT=/opt/habanalabs/rdma-core/src
|
10 |
+
HABANA_PLUGINS_LIB_PATH=/opt/habanalabs/habana_plugins
|
11 |
+
PWD=/data/cronscript/lm-evaluation-harness
|
12 |
+
RDMAV_FORK_SAFE=1
|
13 |
+
LIBFABRIC_ROOT=/opt/habanalabs/libfabric-1.20.0
|
14 |
+
GLIBCPP_FORCE_NEW=1
|
15 |
+
LD_PRELOAD=/lib/x86_64-linux-gnu/libtcmalloc.so.4
|
16 |
+
HOME=/root
|
17 |
+
LANG=en_US.UTF-8
|
18 |
+
MODEL_REFERENCES_ROOT=/Model-References
|
19 |
+
HABANA_VISIBLE_DEVICES=all
|
20 |
+
OS_NUMBER=2204
|
21 |
+
PIP_DEFAULT_TIMEOUT=1000
|
22 |
+
GC_KERNEL_PATH=/usr/lib/habanalabs/libtpc_kernels.so
|
23 |
+
PYTHONPATH=/Model-References/PyTorch/common:/usr/lib/habanalabs/:/data/cronscript/lm-evaluation-harness
|
24 |
+
TERM=xterm
|
25 |
+
PIP_DISABLE_PIP_VERSION_CHECK=1
|
26 |
+
PYTHON=/usr/bin/python3
|
27 |
+
MPI_ROOT=/opt/amazon/openmpi
|
28 |
+
SHLVL=1
|
29 |
+
RDMA_CORE_LIB=/opt/habanalabs/rdma-core/src/build/lib
|
30 |
+
HABANA_SCAL_BIN_PATH=/opt/habanalabs/engines_fw
|
31 |
+
LD_LIBRARY_PATH=/opt/habanalabs/libfabric-1.20.0/lib:/opt/amazon/openmpi/lib:/usr/lib/habanalabs:
|
32 |
+
LC_CTYPE=en_US.UTF-8
|
33 |
+
TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=7516192768
|
34 |
+
OPAL_PREFIX=/opt/amazon/openmpi
|
35 |
+
LC_ALL=en_US.UTF-8
|
36 |
+
PATH=/opt/habanalabs/libfabric-1.20.0/bin:/opt/amazon/openmpi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
37 |
+
LIBFABRIC_VERSION=1.20.0
|
38 |
+
PIP_NO_CACHE_DIR=on
|
39 |
+
DEBIAN_FRONTEND=noninteractive
|
40 |
+
DATA_LOADER_AEON_LIB_PATH=/usr/lib/habanalabs/libaeon.so
|
41 |
+
_=/usr/local/bin/accelerate
|
42 |
+
OLDPWD=/data/cronscript
|
43 |
+
HABANA_PROFILE=profile_api_light
|
44 |
+
MASTER_ADDR=localhost
|
45 |
+
MASTER_PORT=12345
|
46 |
+
WORLD_SIZE=1
|
47 |
+
ACCELERATE_MIXED_PRECISION=bf16
|
48 |
+
ACCELERATE_CONFIG_DS_FIELDS=deepspeed_hostfile,deepspeed_multinode_launcher,gradient_accumulation_steps,zero3_init_flag,zero_stage,mixed_precision
|
49 |
+
ACCELERATE_USE_DEEPSPEED=true
|
50 |
+
ACCELERATE_DEEPSPEED_ZERO_STAGE=1
|
51 |
+
ACCELERATE_GRADIENT_ACCUMULATION_STEPS=1
|
52 |
+
ACCELERATE_DEEPSPEED_ZERO3_INIT=true
|
53 |
+
OMPI_MCA_btl_vader_single_copy_mechanism=none
|
54 |
+
GLIBCXX_FORCE_NEW=1
|
55 |
+
LIBOFI_VERSION=0.0.1
|
56 |
+
HOSTNAME=peacock-0
|
57 |
+
LANGUAGE=en_US.UTF-8
|
58 |
+
MPICC=/opt/amazon/openmpi/bin/mpicc
|
59 |
+
HABANA_LOGS=/var/log/habana_logs/
|
60 |
+
FI_EFA_USE_DEVICE_RDMA=1
|
61 |
+
RDMA_CORE_ROOT=/opt/habanalabs/rdma-core/src
|
62 |
+
HABANA_PLUGINS_LIB_PATH=/opt/habanalabs/habana_plugins
|
63 |
+
PWD=/data/cronscript/lm-evaluation-harness
|
64 |
+
RDMAV_FORK_SAFE=1
|
65 |
+
LIBFABRIC_ROOT=/opt/habanalabs/libfabric-1.20.0
|
66 |
+
GLIBCPP_FORCE_NEW=1
|
67 |
+
LD_PRELOAD=/lib/x86_64-linux-gnu/libtcmalloc.so.4
|
68 |
+
HOME=/root
|
69 |
+
LANG=en_US.UTF-8
|
70 |
+
MODEL_REFERENCES_ROOT=/Model-References
|
71 |
+
HABANA_VISIBLE_DEVICES=all
|
72 |
+
OS_NUMBER=2204
|
73 |
+
PIP_DEFAULT_TIMEOUT=1000
|
74 |
+
GC_KERNEL_PATH=/usr/lib/habanalabs/libtpc_kernels.so
|
75 |
+
PYTHONPATH=/Model-References/PyTorch/common:/usr/lib/habanalabs/:/data/cronscript/lm-evaluation-harness
|
76 |
+
TERM=xterm
|
77 |
+
PIP_DISABLE_PIP_VERSION_CHECK=1
|
78 |
+
PYTHON=/usr/bin/python3
|
79 |
+
MPI_ROOT=/opt/amazon/openmpi
|
80 |
+
SHLVL=1
|
81 |
+
RDMA_CORE_LIB=/opt/habanalabs/rdma-core/src/build/lib
|
82 |
+
HABANA_SCAL_BIN_PATH=/opt/habanalabs/engines_fw
|
83 |
+
LD_LIBRARY_PATH=/opt/habanalabs/libfabric-1.20.0/lib:/opt/amazon/openmpi/lib:/usr/lib/habanalabs:
|
84 |
+
LC_CTYPE=en_US.UTF-8
|
85 |
+
TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=7516192768
|
86 |
+
OPAL_PREFIX=/opt/amazon/openmpi
|
87 |
+
LC_ALL=en_US.UTF-8
|
88 |
+
PATH=/opt/habanalabs/libfabric-1.20.0/bin:/opt/amazon/openmpi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
89 |
+
LIBFABRIC_VERSION=1.20.0
|
90 |
+
PIP_NO_CACHE_DIR=on
|
91 |
+
DEBIAN_FRONTEND=noninteractive
|
92 |
+
DATA_LOADER_AEON_LIB_PATH=/usr/lib/habanalabs/libaeon.so
|
93 |
+
_=/usr/local/bin/accelerate
|
94 |
+
OLDPWD=/data/cronscript
|
95 |
+
HABANA_PROFILE=profile_api_light
|
96 |
+
MASTER_ADDR=localhost
|
97 |
+
MASTER_PORT=12345
|
98 |
+
WORLD_SIZE=1
|
99 |
+
ACCELERATE_MIXED_PRECISION=bf16
|
100 |
+
ACCELERATE_CONFIG_DS_FIELDS=deepspeed_hostfile,deepspeed_multinode_launcher,gradient_accumulation_steps,zero3_init_flag,zero_stage,mixed_precision
|
101 |
+
ACCELERATE_USE_DEEPSPEED=true
|
102 |
+
ACCELERATE_DEEPSPEED_ZERO_STAGE=1
|
103 |
+
ACCELERATE_GRADIENT_ACCUMULATION_STEPS=1
|
104 |
+
ACCELERATE_DEEPSPEED_ZERO3_INIT=true
|
105 |
+
OMPI_MCA_btl_vader_single_copy_mechanism=none
|
106 |
+
GLIBCXX_FORCE_NEW=1
|
107 |
+
LIBOFI_VERSION=0.0.1
|
108 |
+
HOSTNAME=peacock-0
|
109 |
+
LANGUAGE=en_US.UTF-8
|
110 |
+
MPICC=/opt/amazon/openmpi/bin/mpicc
|
111 |
+
HABANA_LOGS=/var/log/habana_logs/
|
112 |
+
FI_EFA_USE_DEVICE_RDMA=1
|
113 |
+
RDMA_CORE_ROOT=/opt/habanalabs/rdma-core/src
|
114 |
+
HABANA_PLUGINS_LIB_PATH=/opt/habanalabs/habana_plugins
|
115 |
+
PWD=/data/cronscript/lm-evaluation-harness
|
116 |
+
RDMAV_FORK_SAFE=1
|
117 |
+
LIBFABRIC_ROOT=/opt/habanalabs/libfabric-1.20.0
|
118 |
+
GLIBCPP_FORCE_NEW=1
|
119 |
+
LD_PRELOAD=/lib/x86_64-linux-gnu/libtcmalloc.so.4
|
120 |
+
HOME=/root
|
121 |
+
LANG=en_US.UTF-8
|
122 |
+
MODEL_REFERENCES_ROOT=/Model-References
|
123 |
+
HABANA_VISIBLE_DEVICES=all
|
124 |
+
OS_NUMBER=2204
|
125 |
+
PIP_DEFAULT_TIMEOUT=1000
|
126 |
+
GC_KERNEL_PATH=/usr/lib/habanalabs/libtpc_kernels.so
|
127 |
+
PYTHONPATH=/Model-References/PyTorch/common:/usr/lib/habanalabs/:/data/cronscript/lm-evaluation-harness
|
128 |
+
TERM=xterm
|
129 |
+
PIP_DISABLE_PIP_VERSION_CHECK=1
|
130 |
+
PYTHON=/usr/bin/python3
|
131 |
+
MPI_ROOT=/opt/amazon/openmpi
|
132 |
+
SHLVL=1
|
133 |
+
RDMA_CORE_LIB=/opt/habanalabs/rdma-core/src/build/lib
|
134 |
+
HABANA_SCAL_BIN_PATH=/opt/habanalabs/engines_fw
|
135 |
+
LD_LIBRARY_PATH=/opt/habanalabs/libfabric-1.20.0/lib:/opt/amazon/openmpi/lib:/usr/lib/habanalabs:
|
136 |
+
LC_CTYPE=en_US.UTF-8
|
137 |
+
TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=7516192768
|
138 |
+
OPAL_PREFIX=/opt/amazon/openmpi
|
139 |
+
LC_ALL=en_US.UTF-8
|
140 |
+
PATH=/opt/habanalabs/libfabric-1.20.0/bin:/opt/amazon/openmpi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
141 |
+
LIBFABRIC_VERSION=1.20.0
|
142 |
+
PIP_NO_CACHE_DIR=on
|
143 |
+
DEBIAN_FRONTEND=noninteractive
|
144 |
+
DATA_LOADER_AEON_LIB_PATH=/usr/lib/habanalabs/libaeon.so
|
145 |
+
_=/usr/local/bin/accelerate
|
146 |
+
OLDPWD=/data/cronscript
|
147 |
+
HABANA_PROFILE=profile_api_light
|
148 |
+
MASTER_ADDR=localhost
|
149 |
+
MASTER_PORT=12345
|
150 |
+
WORLD_SIZE=1
|
151 |
+
ACCELERATE_MIXED_PRECISION=bf16
|
152 |
+
ACCELERATE_CONFIG_DS_FIELDS=deepspeed_hostfile,deepspeed_multinode_launcher,gradient_accumulation_steps,zero3_init_flag,zero_stage,mixed_precision
|
153 |
+
ACCELERATE_USE_DEEPSPEED=true
|
154 |
+
ACCELERATE_DEEPSPEED_ZERO_STAGE=1
|
155 |
+
ACCELERATE_GRADIENT_ACCUMULATION_STEPS=1
|
156 |
+
ACCELERATE_DEEPSPEED_ZERO3_INIT=true
|
lm-evaluation-harness/.pre-commit-config.yaml
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Ignore test linting to avoid conflicting changes to version stability.
|
2 |
+
exclude: ^tests/testdata/
|
3 |
+
repos:
|
4 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
5 |
+
rev: v4.5.0
|
6 |
+
hooks:
|
7 |
+
- id: check-added-large-files
|
8 |
+
- id: check-ast
|
9 |
+
- id: check-byte-order-marker
|
10 |
+
- id: check-case-conflict
|
11 |
+
- id: check-json
|
12 |
+
- id: check-merge-conflict
|
13 |
+
- id: check-symlinks
|
14 |
+
- id: check-yaml
|
15 |
+
args: ["--unsafe"]
|
16 |
+
- id: destroyed-symlinks
|
17 |
+
- id: detect-private-key
|
18 |
+
- id: end-of-file-fixer
|
19 |
+
- id: no-commit-to-branch
|
20 |
+
always_run: false
|
21 |
+
- id: requirements-txt-fixer
|
22 |
+
- id: trailing-whitespace
|
23 |
+
args: [--markdown-linebreak-ext=md]
|
24 |
+
- id: fix-byte-order-marker
|
25 |
+
exclude: docs/CNAME
|
26 |
+
- id: fix-encoding-pragma
|
27 |
+
args: [--remove]
|
28 |
+
- id: mixed-line-ending
|
29 |
+
args: [--fix=lf]
|
30 |
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
31 |
+
# Ruff version.
|
32 |
+
rev: v0.2.2
|
33 |
+
hooks:
|
34 |
+
# Run the linter.
|
35 |
+
- id: ruff
|
36 |
+
args:
|
37 |
+
- --fix
|
38 |
+
# Run the formatter.
|
39 |
+
- id: ruff-format
|
40 |
+
- repo: https://github.com/codespell-project/codespell
|
41 |
+
rev: v2.2.6
|
42 |
+
hooks:
|
43 |
+
- id: codespell
|
44 |
+
exclude: >
|
45 |
+
(?x)^(
|
46 |
+
.*\.json|ignore.txt|lm_eval/tasks/.*|.*yaml|.*\.ipynb
|
47 |
+
)$
|
48 |
+
args: [--check-filenames, --check-hidden, --ignore-words=ignore.txt]
|
49 |
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
50 |
+
rev: v1.5.1
|
51 |
+
hooks:
|
52 |
+
- id: mypy
|
53 |
+
additional_dependencies: [".[sentencepiece,multilingual,promptsource,gptq]", "types-PyYAML", "types-requests"]
|
54 |
+
exclude: ^tests/.*$
|
lm-evaluation-harness/0
ADDED
File without changes
|
lm-evaluation-harness/12
ADDED
File without changes
|
lm-evaluation-harness/15
ADDED
File without changes
|
lm-evaluation-harness/16
ADDED
File without changes
|
lm-evaluation-harness/20
ADDED
File without changes
|
lm-evaluation-harness/6
ADDED
File without changes
|
lm-evaluation-harness/80
ADDED
File without changes
|
lm-evaluation-harness/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
* @haileyschoelkopf @lintangsutawika
|
lm-evaluation-harness/README.md
ADDED
@@ -0,0 +1,451 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Language Model Evaluation Harness
|
2 |
+
|
3 |
+
[](https://doi.org/10.5281/zenodo.10256836)
|
4 |
+
|
5 |
+
## Announcement
|
6 |
+
**A new v0.4.0 release of lm-evaluation-harness is available** !
|
7 |
+
|
8 |
+
New updates and features include:
|
9 |
+
|
10 |
+
- Internal refactoring
|
11 |
+
- Config-based task creation and configuration
|
12 |
+
- Easier import and sharing of externally-defined task config YAMLs
|
13 |
+
- Support for Jinja2 prompt design, easy modification of prompts + prompt imports from Promptsource
|
14 |
+
- More advanced configuration options, including output post-processing, answer extraction, and multiple LM generations per document, configurable fewshot settings, and more
|
15 |
+
- Speedups and new modeling libraries supported, including: faster data-parallel HF model usage, vLLM support, MPS support with HuggingFace, and more
|
16 |
+
- Logging and usability changes
|
17 |
+
- New tasks including CoT BIG-Bench-Hard, Belebele, user-defined task groupings, and more
|
18 |
+
|
19 |
+
Please see our updated documentation pages in `docs/` for more details.
|
20 |
+
|
21 |
+
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)!
|
22 |
+
|
23 |
+
## Overview
|
24 |
+
|
25 |
+
This project provides a unified framework to test generative language models on a large number of different evaluation tasks.
|
26 |
+
|
27 |
+
**Features:**
|
28 |
+
- Over 60 standard academic benchmarks for LLMs, with hundreds of subtasks and variants implemented.
|
29 |
+
- Support for models loaded via [transformers](https://github.com/huggingface/transformers/) (including quantization via [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.
|
30 |
+
- Support for fast and memory-efficient inference with [vLLM](https://github.com/vllm-project/vllm).
|
31 |
+
- Support for commercial APIs including [OpenAI](https://openai.com), and [TextSynth](https://textsynth.com/).
|
32 |
+
- Support for evaluation on adapters (e.g. LoRA) supported in [HuggingFace's PEFT library](https://github.com/huggingface/peft).
|
33 |
+
- Support for local models and benchmarks.
|
34 |
+
- Evaluation with publicly available prompts ensures reproducibility and comparability between papers.
|
35 |
+
- Easy support for custom prompts and evaluation metrics.
|
36 |
+
|
37 |
+
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.
|
38 |
+
|
39 |
+
## Install
|
40 |
+
|
41 |
+
To install the `lm-eval` package from the github repository, run:
|
42 |
+
|
43 |
+
```bash
|
44 |
+
git clone https://github.com/EleutherAI/lm-evaluation-harness
|
45 |
+
cd lm-evaluation-harness
|
46 |
+
pip install -e .
|
47 |
+
```
|
48 |
+
|
49 |
+
We also provide a number of optional dependencies for extended functionality. A detailed table is available at the end of this document.
|
50 |
+
|
51 |
+
## Basic Usage
|
52 |
+
|
53 |
+
### Hugging Face `transformers`
|
54 |
+
|
55 |
+
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):
|
56 |
+
|
57 |
+
```bash
|
58 |
+
lm_eval --model hf \
|
59 |
+
--model_args pretrained=EleutherAI/gpt-j-6B \
|
60 |
+
--tasks hellaswag \
|
61 |
+
--device cuda:0 \
|
62 |
+
--batch_size 8
|
63 |
+
```
|
64 |
+
|
65 |
+
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:
|
66 |
+
|
67 |
+
```bash
|
68 |
+
lm_eval --model hf \
|
69 |
+
--model_args pretrained=EleutherAI/pythia-160m,revision=step100000,dtype="float" \
|
70 |
+
--tasks lambada_openai,hellaswag \
|
71 |
+
--device cuda:0 \
|
72 |
+
--batch_size 8
|
73 |
+
```
|
74 |
+
|
75 |
+
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.
|
76 |
+
|
77 |
+
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:
|
78 |
+
|
79 |
+
```bash
|
80 |
+
lm_eval --model hf \
|
81 |
+
--model_args pretrained=EleutherAI/pythia-160m,revision=step100000,dtype="float" \
|
82 |
+
--tasks lambada_openai,hellaswag \
|
83 |
+
--device cuda:0 \
|
84 |
+
--batch_size auto:4
|
85 |
+
```
|
86 |
+
|
87 |
+
The full list of supported arguments are provided [here](./docs/interface.md), and on the terminal by calling `lm_eval -h`. Alternatively, you can use `lm-eval` instead of `lm_eval`. A list of supported tasks can be viewed with `lm-eval --tasks list`.
|
88 |
+
|
89 |
+
> [!Note]
|
90 |
+
> 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`
|
91 |
+
|
92 |
+
#### Multi-GPU Evaluation with Hugging Face `accelerate`
|
93 |
+
|
94 |
+
We support two main ways of using Hugging Face's [accelerate 🚀](https://github.com/huggingface/accelerate) library for multi-GPU evaluation.
|
95 |
+
|
96 |
+
To perform *data-parallel evaluation* (where each GPU loads a **separate full copy** of the model), we leverage the `accelerate` launcher as follows:
|
97 |
+
|
98 |
+
```
|
99 |
+
accelerate launch -m lm_eval --model hf \
|
100 |
+
--tasks lambada_openai,arc_easy \
|
101 |
+
--batch_size 16
|
102 |
+
```
|
103 |
+
(or via `accelerate launch --no-python lm_eval`).
|
104 |
+
|
105 |
+
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.
|
106 |
+
|
107 |
+
**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.
|
108 |
+
|
109 |
+
The second way of using `accelerate` for multi-GPU evaluation is when your model is *too large to fit on a single GPU.*
|
110 |
+
|
111 |
+
In this setting, run the library *outside of the `accelerate` launcher*, but passing `parallelize=True` to `--model_args` as follows:
|
112 |
+
|
113 |
+
```
|
114 |
+
lm_eval --model hf \
|
115 |
+
--tasks lambada_openai,arc_easy \
|
116 |
+
--model_args parallelize=True \
|
117 |
+
--batch_size 16
|
118 |
+
```
|
119 |
+
|
120 |
+
This means that your model's weights will be split across all available GPUs.
|
121 |
+
|
122 |
+
For more advanced users or even larger models, we allow for the following arguments when `parallelize=True` as well:
|
123 |
+
- `device_map_option`: How to split model weights across available GPUs. defaults to "auto".
|
124 |
+
- `max_memory_per_gpu`: the max GPU memory to use per GPU in loading the model.
|
125 |
+
- `max_cpu_memory`: the max amount of CPU memory to use when offloading the model weights to RAM.
|
126 |
+
- `offload_folder`: a folder where model weights will be offloaded to disk if needed.
|
127 |
+
|
128 |
+
These two options (`accelerate launch` and `parallelize=True`) are mutually exclusive.
|
129 |
+
|
130 |
+
**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).**
|
131 |
+
|
132 |
+
### NVIDIA `nemo` models
|
133 |
+
|
134 |
+
[NVIDIA NeMo Framework](https://github.com/NVIDIA/NeMo) is a generative AI framework built for researchers and pytorch developers working on language models.
|
135 |
+
|
136 |
+
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).
|
137 |
+
|
138 |
+
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`.
|
139 |
+
|
140 |
+
Run a `nemo` model on one GPU:
|
141 |
+
```bash
|
142 |
+
lm_eval --model nemo_lm \
|
143 |
+
--model_args path=<path_to_nemo_model> \
|
144 |
+
--tasks hellaswag \
|
145 |
+
--batch_size 32
|
146 |
+
```
|
147 |
+
|
148 |
+
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:
|
149 |
+
|
150 |
+
```
|
151 |
+
mkdir MY_MODEL
|
152 |
+
tar -xvf MY_MODEL.nemo -c MY_MODEL
|
153 |
+
```
|
154 |
+
|
155 |
+
#### Multi-GPU evaluation with NVIDIA `nemo` models
|
156 |
+
|
157 |
+
By default, only one GPU is used. But we do support either data replication or tensor/pipeline parallelism during evaluation, on one node.
|
158 |
+
|
159 |
+
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:
|
160 |
+
```bash
|
161 |
+
torchrun --nproc-per-node=8 --no-python lm_eval \
|
162 |
+
--model nemo_lm \
|
163 |
+
--model_args path=<path_to_nemo_model>,devices=8 \
|
164 |
+
--tasks hellaswag \
|
165 |
+
--batch_size 32
|
166 |
+
```
|
167 |
+
|
168 |
+
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:
|
169 |
+
```bash
|
170 |
+
torchrun --nproc-per-node=4 --no-python lm_eval \
|
171 |
+
--model nemo_lm \
|
172 |
+
--model_args path=<path_to_nemo_model>,devices=4,tensor_model_parallel_size=2,pipeline_model_parallel_size=2 \
|
173 |
+
--tasks hellaswag \
|
174 |
+
--batch_size 32
|
175 |
+
```
|
176 |
+
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.
|
177 |
+
|
178 |
+
Not supported yet: multi-node evaluation and combinations of data replication with tensor or pipeline parallelism.
|
179 |
+
|
180 |
+
### Tensor + Data Parallel and Optimized Inference with `vLLM`
|
181 |
+
|
182 |
+
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:
|
183 |
+
|
184 |
+
```bash
|
185 |
+
lm_eval --model vllm \
|
186 |
+
--model_args pretrained={model_name},tensor_parallel_size={GPUs_per_model},dtype=auto,gpu_memory_utilization=0.8,data_parallel_size={model_replicas} \
|
187 |
+
--tasks lambada_openai \
|
188 |
+
--batch_size auto
|
189 |
+
```
|
190 |
+
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.
|
191 |
+
|
192 |
+
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.
|
193 |
+
|
194 |
+
> [!Tip]
|
195 |
+
> For fastest performance, we recommend using `--batch_size auto` for vLLM whenever possible, to leverage its continuous batching functionality!
|
196 |
+
|
197 |
+
> [!Tip]
|
198 |
+
> 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.
|
199 |
+
|
200 |
+
### Model APIs and Inference Servers
|
201 |
+
|
202 |
+
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.
|
203 |
+
|
204 |
+
To call a hosted model, use:
|
205 |
+
|
206 |
+
```bash
|
207 |
+
export OPENAI_API_KEY=YOUR_KEY_HERE
|
208 |
+
lm_eval --model openai-completions \
|
209 |
+
--model_args model=davinci \
|
210 |
+
--tasks lambada_openai,hellaswag
|
211 |
+
```
|
212 |
+
|
213 |
+
We also support using your own local inference server with servers that mirror the OpenAI Completions and ChatCompletions APIs.
|
214 |
+
|
215 |
+
```bash
|
216 |
+
lm_eval --model local-chat-completions --tasks gsm8k --model_args model=facebook/opt-125m,base_url=http://{yourip}:8000/v1
|
217 |
+
```
|
218 |
+
Note that for externally hosted models, configs such as `--device` and `--batch_size` 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.
|
219 |
+
|
220 |
+
| API or Inference Server | Implemented? | `--model <xxx>` name | Models supported: | Request Types: |
|
221 |
+
|---------------------------------------------------------------------------------------------------------------------------|---------------------------------|---------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|------------------------------------------------------------|
|
222 |
+
| OpenAI Completions | :heavy_check_mark: | `openai-completions`, `local-completions` | All OpenAI Completions API models | `generate_until`, `loglikelihood`, `loglikelihood_rolling` |
|
223 |
+
| 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) |
|
224 |
+
| Anthropic | :heavy_check_mark: | `anthropic` | [Supported Anthropic Engines](https://docs.anthropic.com/claude/reference/selecting-a-model) | `generate_until` (no logprobs) |
|
225 |
+
| 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) |
|
226 |
+
| Textsynth | :heavy_check_mark: | `textsynth` | [All supported engines](https://textsynth.com/documentation.html#engines) | `generate_until`, `loglikelihood`, `loglikelihood_rolling` |
|
227 |
+
| 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` |
|
228 |
+
| [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) |
|
229 |
+
| 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` |
|
230 |
+
| 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` |
|
231 |
+
| Huggingface Optimum (Causal LMs) | ✔️ | `openvino` | Any decoder-only AutoModelForCausalLM converted with Huggingface Optimum into OpenVINO™ Intermediate Representation (IR) format | `generate_until`, `loglikelihood`, `loglikelihood_rolling` | ... |
|
232 |
+
| 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` | ... |
|
233 |
+
| [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` | ... |
|
234 |
+
| [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` | ... |
|
235 |
+
| Your local inference server! | :heavy_check_mark: | `local-completions` or `local-chat-completions` (using `openai-chat-completions` model type) | Any server address that accepts GET requests using HF models and mirror's OpenAI's Completions or ChatCompletions interface | `generate_until` | | ... |
|
236 |
+
|
237 |
+
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`.
|
238 |
+
|
239 |
+
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).
|
240 |
+
|
241 |
+
> [!Note]
|
242 |
+
> 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.
|
243 |
+
|
244 |
+
|
245 |
+
### Other Frameworks
|
246 |
+
|
247 |
+
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).
|
248 |
+
|
249 |
+
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).
|
250 |
+
|
251 |
+
### Additional Features
|
252 |
+
> [!Note]
|
253 |
+
> 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.
|
254 |
+
|
255 |
+
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.**
|
256 |
+
|
257 |
+
> [!Note]
|
258 |
+
> You can inspect what the LM inputs look like by running the following command:
|
259 |
+
> ```bash
|
260 |
+
> python write_out.py \
|
261 |
+
> --tasks <task1,task2,...> \
|
262 |
+
> --num_fewshot 5 \
|
263 |
+
> --num_examples 10 \
|
264 |
+
> --output_base_path /path/to/output/folder
|
265 |
+
> ```
|
266 |
+
> This will write out one text file for each task.
|
267 |
+
|
268 |
+
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:
|
269 |
+
|
270 |
+
```bash
|
271 |
+
lm_eval --model openai \
|
272 |
+
--model_args engine=davinci \
|
273 |
+
--tasks lambada_openai,hellaswag \
|
274 |
+
--check_integrity
|
275 |
+
```
|
276 |
+
|
277 |
+
## Advanced Usage Tips
|
278 |
+
|
279 |
+
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:
|
280 |
+
```bash
|
281 |
+
lm_eval --model hf \
|
282 |
+
--model_args pretrained=EleutherAI/gpt-j-6b,parallelize=True,load_in_4bit=True,peft=nomic-ai/gpt4all-j-lora \
|
283 |
+
--tasks openbookqa,arc_easy,winogrande,hellaswag,arc_challenge,piqa,boolq \
|
284 |
+
--device cuda:0
|
285 |
+
```
|
286 |
+
|
287 |
+
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:
|
288 |
+
```bash
|
289 |
+
lm_eval --model hf \
|
290 |
+
--model_args pretrained=Ejafa/llama_7B,delta=lmsys/vicuna-7b-delta-v1.1 \
|
291 |
+
--tasks hellaswag
|
292 |
+
```
|
293 |
+
|
294 |
+
[GPTQ](https://github.com/PanQiWei/AutoGPTQ) quantized models can be loaded by specifying their file names in `,autogptq=NAME` (or `,autogptq=True` for default names) in the `model_args` argument:
|
295 |
+
|
296 |
+
```bash
|
297 |
+
lm_eval --model hf \
|
298 |
+
--model_args pretrained=model-name-or-path,autogptq=model.safetensors,gptq_use_triton=True \
|
299 |
+
--tasks hellaswag
|
300 |
+
```
|
301 |
+
|
302 |
+
We support wildcards in task names, for example you can run all of the machine-translated lambada tasks via `--task lambada_openai_mt_*`.
|
303 |
+
|
304 |
+
To save evaluation results provide an `--output_path`. We also support logging model responses with the `--log_samples` flag for post-hoc analysis.
|
305 |
+
|
306 |
+
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.
|
307 |
+
|
308 |
+
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!
|
309 |
+
|
310 |
+
## Visualizing Results
|
311 |
+
|
312 |
+
You can seamlessly visualize and analyze the results of your evaluation harness runs using both Weights & Biases (W&B) and Zeno.
|
313 |
+
|
314 |
+
### Zeno
|
315 |
+
|
316 |
+
You can use [Zeno](https://zenoml.com) to visualize the results of your eval harness runs.
|
317 |
+
|
318 |
+
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).
|
319 |
+
Add this key as an environment variable:
|
320 |
+
|
321 |
+
```bash
|
322 |
+
export ZENO_API_KEY=[your api key]
|
323 |
+
```
|
324 |
+
|
325 |
+
You'll also need to install the `lm_eval[zeno]` package extra.
|
326 |
+
|
327 |
+
To visualize the results, run the eval harness with the `log_samples` and `output_path` flags.
|
328 |
+
We expect `output_path` to contain multiple folders that represent individual model names.
|
329 |
+
You can thus run your evaluation on any number of tasks and models and upload all of the results as projects on Zeno.
|
330 |
+
|
331 |
+
```bash
|
332 |
+
lm_eval \
|
333 |
+
--model hf \
|
334 |
+
--model_args pretrained=EleutherAI/gpt-j-6B \
|
335 |
+
--tasks hellaswag \
|
336 |
+
--device cuda:0 \
|
337 |
+
--batch_size 8 \
|
338 |
+
--log_samples \
|
339 |
+
--output_path output/gpt-j-6B
|
340 |
+
```
|
341 |
+
|
342 |
+
Then, you can upload the resulting data using the `zeno_visualize` script:
|
343 |
+
|
344 |
+
```bash
|
345 |
+
python scripts/zeno_visualize.py \
|
346 |
+
--data_path output \
|
347 |
+
--project_name "Eleuther Project"
|
348 |
+
```
|
349 |
+
|
350 |
+
This will use all subfolders in `data_path` as different models and upload all tasks within these model folders to Zeno.
|
351 |
+
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.
|
352 |
+
|
353 |
+
You can find an example of this workflow in [examples/visualize-zeno.ipynb](examples/visualize-zeno.ipynb).
|
354 |
+
|
355 |
+
### Weights and Biases
|
356 |
+
|
357 |
+
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.
|
358 |
+
|
359 |
+
The integration provide functionalities
|
360 |
+
|
361 |
+
- to automatically log the evaluation results,
|
362 |
+
- log the samples as W&B Tables for easy visualization,
|
363 |
+
- log the `results.json` file as an artifact for version control,
|
364 |
+
- log the `<task_name>_eval_samples.json` file if the samples are logged,
|
365 |
+
- generate a comprehensive report for analysis and visualization with all the important metric,
|
366 |
+
- log task and cli specific configs,
|
367 |
+
- and more out of the box like the command used to run the evaluation, GPU/CPU counts, timestamp, etc.
|
368 |
+
|
369 |
+
First you'll need to install the lm_eval[wandb] package extra. Do `pip install lm_eval[wandb]`.
|
370 |
+
|
371 |
+
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.
|
372 |
+
|
373 |
+
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.
|
374 |
+
|
375 |
+
```bash
|
376 |
+
lm_eval \
|
377 |
+
--model hf \
|
378 |
+
--model_args pretrained=microsoft/phi-2,trust_remote_code=True \
|
379 |
+
--tasks hellaswag,mmlu_abstract_algebra \
|
380 |
+
--device cuda:0 \
|
381 |
+
--batch_size 8 \
|
382 |
+
--output_path output/phi-2 \
|
383 |
+
--limit 10 \
|
384 |
+
--wandb_args project=lm-eval-harness-integration \
|
385 |
+
--log_samples
|
386 |
+
```
|
387 |
+
|
388 |
+
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.
|
389 |
+
|
390 |
+
## How to Contribute or Learn More?
|
391 |
+
|
392 |
+
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.
|
393 |
+
|
394 |
+
### Implementing new tasks
|
395 |
+
|
396 |
+
To implement a new task in the eval harness, see [this guide](./docs/new_task_guide.md).
|
397 |
+
|
398 |
+
In general, we follow this priority list for addressing concerns about prompting and other eval details:
|
399 |
+
1. If there is widespread agreement among people who train LLMs, use the agreed upon procedure.
|
400 |
+
2. If there is a clear and unambiguous official implementation, use that procedure.
|
401 |
+
3. If there is widespread agreement among people who evaluate LLMs, use the agreed upon procedure.
|
402 |
+
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.
|
403 |
+
|
404 |
+
These are guidelines and not rules, and can be overruled in special circumstances.
|
405 |
+
|
406 |
+
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.
|
407 |
+
|
408 |
+
### Support
|
409 |
+
|
410 |
+
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!
|
411 |
+
|
412 |
+
## Optional Extras
|
413 |
+
Extras dependencies can be installed via `pip install -e ".[NAME]"`
|
414 |
+
|
415 |
+
| Name | Use |
|
416 |
+
|---------------|---------------------------------------|
|
417 |
+
| anthropic | For using Anthropic's models |
|
418 |
+
| deepsparse | For running NM's DeepSparse models |
|
419 |
+
| dev | For linting PRs and contributions |
|
420 |
+
| gptq | For loading models with GPTQ |
|
421 |
+
| hf_transfer | For speeding up HF Hub file downloads |
|
422 |
+
| ifeval | For running the IFEval task |
|
423 |
+
| neuronx | For running on AWS inf2 instances |
|
424 |
+
| mamba | For loading Mamba SSM models |
|
425 |
+
| math | For running math task answer checking |
|
426 |
+
| multilingual | For multilingual tokenizers |
|
427 |
+
| openai | For using OpenAI's models |
|
428 |
+
| optimum | For running Intel OpenVINO models |
|
429 |
+
| promptsource | For using PromptSource prompts |
|
430 |
+
| sentencepiece | For using the sentencepiece tokenizer |
|
431 |
+
| sparseml | For using NM's SparseML models |
|
432 |
+
| testing | For running library test suite |
|
433 |
+
| vllm | For loading models with vLLM |
|
434 |
+
| zeno | For visualizing results with Zeno |
|
435 |
+
|---------------|---------------------------------------|
|
436 |
+
| all | Loads all extras (not recommended) |
|
437 |
+
|
438 |
+
## Cite as
|
439 |
+
|
440 |
+
```
|
441 |
+
@misc{eval-harness,
|
442 |
+
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},
|
443 |
+
title = {A framework for few-shot language model evaluation},
|
444 |
+
month = 12,
|
445 |
+
year = 2023,
|
446 |
+
publisher = {Zenodo},
|
447 |
+
version = {v0.4.0},
|
448 |
+
doi = {10.5281/zenodo.10256836},
|
449 |
+
url = {https://zenodo.org/records/10256836}
|
450 |
+
}
|
451 |
+
```
|
lm-evaluation-harness/ignore.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ROUGE
|
2 |
+
rouge
|
3 |
+
nin
|
4 |
+
maka
|
5 |
+
mor
|
6 |
+
te
|
7 |
+
ond
|
8 |
+
extraversion
|
lm-evaluation-harness/mypy.ini
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[mypy]
|
2 |
+
python_version = 3.8
|
3 |
+
show_traceback = True
|
4 |
+
check_untyped_defs = True
|
5 |
+
no_implicit_reexport = True
|
6 |
+
warn_unreachable = True
|
7 |
+
warn_unused_configs = True
|
8 |
+
warn_unused_ignores = True
|
9 |
+
warn_redundant_casts = True
|
10 |
+
|
11 |
+
# We ignore errors everywhere to gradually add type annotations
|
12 |
+
|
13 |
+
[mypy-lm_eval.*]
|
14 |
+
ignore_errors = True
|
15 |
+
|
16 |
+
[mypy-lm_eval.api.*]
|
17 |
+
ignore_errors = True
|
18 |
+
|
19 |
+
[mypy-lm_eval.prompts.*]
|
20 |
+
ignore_errors = True
|
21 |
+
|
22 |
+
[mypy-lm_eval.models.*]
|
23 |
+
ignore_errors = True
|
24 |
+
|
25 |
+
[mypy-scripts.*]
|
26 |
+
ignore_errors = True
|
27 |
+
|
28 |
+
[mypy-main]
|
29 |
+
ignore_errors = True
|
lm-evaluation-harness/pile_statistics.json
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Data": "Pile statistics",
|
3 |
+
"Document Count": 210607728,
|
4 |
+
"Total Pile Characters": 421215456,
|
5 |
+
"File Start Offsets": [
|
6 |
+
0,
|
7 |
+
7021438,
|
8 |
+
14042822,
|
9 |
+
21066113,
|
10 |
+
28086515,
|
11 |
+
35106072,
|
12 |
+
42123306,
|
13 |
+
49145091,
|
14 |
+
56165817,
|
15 |
+
63185587,
|
16 |
+
70211208,
|
17 |
+
77234322,
|
18 |
+
84249267,
|
19 |
+
91267634,
|
20 |
+
98285983,
|
21 |
+
105305110,
|
22 |
+
112322489,
|
23 |
+
119342491,
|
24 |
+
126367373,
|
25 |
+
133389153,
|
26 |
+
140412039,
|
27 |
+
147432373,
|
28 |
+
154452516,
|
29 |
+
161470190,
|
30 |
+
168492733,
|
31 |
+
175512521,
|
32 |
+
182526939,
|
33 |
+
189547478,
|
34 |
+
196565318,
|
35 |
+
203583306
|
36 |
+
]
|
37 |
+
}
|
lm-evaluation-harness/pyproject.toml
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[build-system]
|
2 |
+
requires = ["setuptools>=40.8.0", "wheel"]
|
3 |
+
build-backend = "setuptools.build_meta"
|
4 |
+
|
5 |
+
[project]
|
6 |
+
name = "lm_eval"
|
7 |
+
version = "0.4.2"
|
8 |
+
authors = [
|
9 |
+
{name="EleutherAI", email="[email protected]"}
|
10 |
+
]
|
11 |
+
description = "A framework for evaluating language models"
|
12 |
+
readme = "README.md"
|
13 |
+
classifiers = [
|
14 |
+
"Development Status :: 3 - Alpha",
|
15 |
+
"Programming Language :: Python :: 3",
|
16 |
+
"License :: OSI Approved :: MIT License",
|
17 |
+
"Operating System :: OS Independent",
|
18 |
+
]
|
19 |
+
requires-python = ">=3.8"
|
20 |
+
license = { "text" = "MIT" }
|
21 |
+
dependencies = [
|
22 |
+
"accelerate>=0.21.0",
|
23 |
+
"evaluate",
|
24 |
+
"datasets>=2.16.0",
|
25 |
+
"evaluate>=0.4.0",
|
26 |
+
"jsonlines",
|
27 |
+
"numexpr",
|
28 |
+
"peft>=0.2.0",
|
29 |
+
"pybind11>=2.6.2",
|
30 |
+
"pytablewriter",
|
31 |
+
"rouge-score>=0.0.4",
|
32 |
+
"sacrebleu>=1.5.0",
|
33 |
+
"scikit-learn>=0.24.1",
|
34 |
+
"sqlitedict",
|
35 |
+
"torch>=1.8",
|
36 |
+
"tqdm-multiprocess",
|
37 |
+
"transformers>=4.1",
|
38 |
+
"zstandard",
|
39 |
+
"dill",
|
40 |
+
"word2number",
|
41 |
+
"more_itertools",
|
42 |
+
]
|
43 |
+
|
44 |
+
[tool.setuptools.packages.find]
|
45 |
+
include = ["lm_eval*"]
|
46 |
+
|
47 |
+
# required to include yaml files in pip installation
|
48 |
+
[tool.setuptools.package-data]
|
49 |
+
lm_eval = ["**/*.yaml", "tasks/**/*"]
|
50 |
+
|
51 |
+
[project.scripts]
|
52 |
+
lm-eval = "lm_eval.__main__:cli_evaluate"
|
53 |
+
lm_eval = "lm_eval.__main__:cli_evaluate"
|
54 |
+
|
55 |
+
[project.urls]
|
56 |
+
Homepage = "https://github.com/EleutherAI/lm-evaluation-harness"
|
57 |
+
Repository = "https://github.com/EleutherAI/lm-evaluation-harness"
|
58 |
+
|
59 |
+
[project.optional-dependencies]
|
60 |
+
anthropic = ["anthropic"]
|
61 |
+
dev = ["pytest", "pytest-cov", "pytest-xdist", "pre-commit", "mypy"]
|
62 |
+
deepsparse = ["deepsparse-nightly[llm]>=1.8.0.20240404"]
|
63 |
+
gptq = ["auto-gptq[triton]>=0.6.0"]
|
64 |
+
hf_transfer = ["hf_transfer"]
|
65 |
+
ifeval = ["langdetect", "immutabledict"]
|
66 |
+
neuronx = ["optimum[neuronx]"]
|
67 |
+
mamba = ["mamba_ssm", "causal-conv1d==1.0.2"]
|
68 |
+
math = ["sympy>=1.12", "antlr4-python3-runtime==4.11"]
|
69 |
+
multilingual = ["nagisa>=0.2.7", "jieba>=0.42.1", "pycountry"]
|
70 |
+
openai = ["openai==1.3.9", "tiktoken"]
|
71 |
+
optimum = ["optimum[openvino]"]
|
72 |
+
promptsource = ["promptsource>=0.2.3"]
|
73 |
+
sentencepiece = ["sentencepiece>=0.1.98"]
|
74 |
+
sparseml = ["sparseml-nightly[llm]>=1.8.0.20240404"]
|
75 |
+
testing = ["pytest", "pytest-cov", "pytest-xdist"]
|
76 |
+
vllm = ["vllm==0.3.2"]
|
77 |
+
zeno = ["pandas", "zeno-client"]
|
78 |
+
wandb = ["wandb>=0.16.3", "pandas", "numpy"]
|
79 |
+
all = [
|
80 |
+
"lm_eval[anthropic]",
|
81 |
+
"lm_eval[dev]",
|
82 |
+
"lm_eval[deepsparse]",
|
83 |
+
"lm_eval[gptq]",
|
84 |
+
"lm_eval[hf_transfer]",
|
85 |
+
"lm_eval[ifeval]",
|
86 |
+
"lm_eval[mamba]",
|
87 |
+
"lm_eval[math]",
|
88 |
+
"lm_eval[multilingual]",
|
89 |
+
"lm_eval[openai]",
|
90 |
+
"lm_eval[promptsource]",
|
91 |
+
"lm_eval[sentencepiece]",
|
92 |
+
"lm_eval[sparseml]",
|
93 |
+
"lm_eval[testing]",
|
94 |
+
"lm_eval[vllm]",
|
95 |
+
"lm_eval[zeno]",
|
96 |
+
"lm_eval[wandb]",
|
97 |
+
]
|
98 |
+
|
99 |
+
[tool.ruff.lint]
|
100 |
+
extend-select = ["I"]
|
101 |
+
|
102 |
+
[tool.ruff.lint.isort]
|
103 |
+
lines-after-imports = 2
|
104 |
+
known-first-party = ["lm_eval"]
|
105 |
+
|
106 |
+
[tool.ruff.lint.extend-per-file-ignores]
|
107 |
+
"__init__.py" = ["F401","F402","F403"]
|
lm-evaluation-harness/setup.py
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import setuptools
|
2 |
+
|
3 |
+
|
4 |
+
# This is to make sure that the package supports editable installs
|
5 |
+
setuptools.setup()
|
venv/bin/Activate.ps1
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<#
|
2 |
+
.Synopsis
|
3 |
+
Activate a Python virtual environment for the current PowerShell session.
|
4 |
+
|
5 |
+
.Description
|
6 |
+
Pushes the python executable for a virtual environment to the front of the
|
7 |
+
$Env:PATH environment variable and sets the prompt to signify that you are
|
8 |
+
in a Python virtual environment. Makes use of the command line switches as
|
9 |
+
well as the `pyvenv.cfg` file values present in the virtual environment.
|
10 |
+
|
11 |
+
.Parameter VenvDir
|
12 |
+
Path to the directory that contains the virtual environment to activate. The
|
13 |
+
default value for this is the parent of the directory that the Activate.ps1
|
14 |
+
script is located within.
|
15 |
+
|
16 |
+
.Parameter Prompt
|
17 |
+
The prompt prefix to display when this virtual environment is activated. By
|
18 |
+
default, this prompt is the name of the virtual environment folder (VenvDir)
|
19 |
+
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
20 |
+
|
21 |
+
.Example
|
22 |
+
Activate.ps1
|
23 |
+
Activates the Python virtual environment that contains the Activate.ps1 script.
|
24 |
+
|
25 |
+
.Example
|
26 |
+
Activate.ps1 -Verbose
|
27 |
+
Activates the Python virtual environment that contains the Activate.ps1 script,
|
28 |
+
and shows extra information about the activation as it executes.
|
29 |
+
|
30 |
+
.Example
|
31 |
+
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
32 |
+
Activates the Python virtual environment located in the specified location.
|
33 |
+
|
34 |
+
.Example
|
35 |
+
Activate.ps1 -Prompt "MyPython"
|
36 |
+
Activates the Python virtual environment that contains the Activate.ps1 script,
|
37 |
+
and prefixes the current prompt with the specified string (surrounded in
|
38 |
+
parentheses) while the virtual environment is active.
|
39 |
+
|
40 |
+
.Notes
|
41 |
+
On Windows, it may be required to enable this Activate.ps1 script by setting the
|
42 |
+
execution policy for the user. You can do this by issuing the following PowerShell
|
43 |
+
command:
|
44 |
+
|
45 |
+
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
46 |
+
|
47 |
+
For more information on Execution Policies:
|
48 |
+
https://go.microsoft.com/fwlink/?LinkID=135170
|
49 |
+
|
50 |
+
#>
|
51 |
+
Param(
|
52 |
+
[Parameter(Mandatory = $false)]
|
53 |
+
[String]
|
54 |
+
$VenvDir,
|
55 |
+
[Parameter(Mandatory = $false)]
|
56 |
+
[String]
|
57 |
+
$Prompt
|
58 |
+
)
|
59 |
+
|
60 |
+
<# Function declarations --------------------------------------------------- #>
|
61 |
+
|
62 |
+
<#
|
63 |
+
.Synopsis
|
64 |
+
Remove all shell session elements added by the Activate script, including the
|
65 |
+
addition of the virtual environment's Python executable from the beginning of
|
66 |
+
the PATH variable.
|
67 |
+
|
68 |
+
.Parameter NonDestructive
|
69 |
+
If present, do not remove this function from the global namespace for the
|
70 |
+
session.
|
71 |
+
|
72 |
+
#>
|
73 |
+
function global:deactivate ([switch]$NonDestructive) {
|
74 |
+
# Revert to original values
|
75 |
+
|
76 |
+
# The prior prompt:
|
77 |
+
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
|
78 |
+
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
|
79 |
+
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
|
80 |
+
}
|
81 |
+
|
82 |
+
# The prior PYTHONHOME:
|
83 |
+
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
|
84 |
+
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
|
85 |
+
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
|
86 |
+
}
|
87 |
+
|
88 |
+
# The prior PATH:
|
89 |
+
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
|
90 |
+
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
|
91 |
+
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
|
92 |
+
}
|
93 |
+
|
94 |
+
# Just remove the VIRTUAL_ENV altogether:
|
95 |
+
if (Test-Path -Path Env:VIRTUAL_ENV) {
|
96 |
+
Remove-Item -Path env:VIRTUAL_ENV
|
97 |
+
}
|
98 |
+
|
99 |
+
# Just remove VIRTUAL_ENV_PROMPT altogether.
|
100 |
+
if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
|
101 |
+
Remove-Item -Path env:VIRTUAL_ENV_PROMPT
|
102 |
+
}
|
103 |
+
|
104 |
+
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
105 |
+
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
106 |
+
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
107 |
+
}
|
108 |
+
|
109 |
+
# Leave deactivate function in the global namespace if requested:
|
110 |
+
if (-not $NonDestructive) {
|
111 |
+
Remove-Item -Path function:deactivate
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
<#
|
116 |
+
.Description
|
117 |
+
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
118 |
+
given folder, and returns them in a map.
|
119 |
+
|
120 |
+
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
121 |
+
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
122 |
+
then it is considered a `key = value` line. The left hand string is the key,
|
123 |
+
the right hand is the value.
|
124 |
+
|
125 |
+
If the value starts with a `'` or a `"` then the first and last character is
|
126 |
+
stripped from the value before being captured.
|
127 |
+
|
128 |
+
.Parameter ConfigDir
|
129 |
+
Path to the directory that contains the `pyvenv.cfg` file.
|
130 |
+
#>
|
131 |
+
function Get-PyVenvConfig(
|
132 |
+
[String]
|
133 |
+
$ConfigDir
|
134 |
+
) {
|
135 |
+
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
136 |
+
|
137 |
+
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
138 |
+
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
139 |
+
|
140 |
+
# An empty map will be returned if no config file is found.
|
141 |
+
$pyvenvConfig = @{ }
|
142 |
+
|
143 |
+
if ($pyvenvConfigPath) {
|
144 |
+
|
145 |
+
Write-Verbose "File exists, parse `key = value` lines"
|
146 |
+
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
147 |
+
|
148 |
+
$pyvenvConfigContent | ForEach-Object {
|
149 |
+
$keyval = $PSItem -split "\s*=\s*", 2
|
150 |
+
if ($keyval[0] -and $keyval[1]) {
|
151 |
+
$val = $keyval[1]
|
152 |
+
|
153 |
+
# Remove extraneous quotations around a string value.
|
154 |
+
if ("'""".Contains($val.Substring(0, 1))) {
|
155 |
+
$val = $val.Substring(1, $val.Length - 2)
|
156 |
+
}
|
157 |
+
|
158 |
+
$pyvenvConfig[$keyval[0]] = $val
|
159 |
+
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
163 |
+
return $pyvenvConfig
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
<# Begin Activate script --------------------------------------------------- #>
|
168 |
+
|
169 |
+
# Determine the containing directory of this script
|
170 |
+
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
171 |
+
$VenvExecDir = Get-Item -Path $VenvExecPath
|
172 |
+
|
173 |
+
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
174 |
+
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
175 |
+
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
176 |
+
|
177 |
+
# Set values required in priority: CmdLine, ConfigFile, Default
|
178 |
+
# First, get the location of the virtual environment, it might not be
|
179 |
+
# VenvExecDir if specified on the command line.
|
180 |
+
if ($VenvDir) {
|
181 |
+
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
182 |
+
}
|
183 |
+
else {
|
184 |
+
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
185 |
+
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
186 |
+
Write-Verbose "VenvDir=$VenvDir"
|
187 |
+
}
|
188 |
+
|
189 |
+
# Next, read the `pyvenv.cfg` file to determine any required value such
|
190 |
+
# as `prompt`.
|
191 |
+
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
192 |
+
|
193 |
+
# Next, set the prompt from the command line, or the config file, or
|
194 |
+
# just use the name of the virtual environment folder.
|
195 |
+
if ($Prompt) {
|
196 |
+
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
197 |
+
}
|
198 |
+
else {
|
199 |
+
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
200 |
+
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
201 |
+
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
202 |
+
$Prompt = $pyvenvCfg['prompt'];
|
203 |
+
}
|
204 |
+
else {
|
205 |
+
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
|
206 |
+
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
207 |
+
$Prompt = Split-Path -Path $venvDir -Leaf
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
Write-Verbose "Prompt = '$Prompt'"
|
212 |
+
Write-Verbose "VenvDir='$VenvDir'"
|
213 |
+
|
214 |
+
# Deactivate any currently active virtual environment, but leave the
|
215 |
+
# deactivate function in place.
|
216 |
+
deactivate -nondestructive
|
217 |
+
|
218 |
+
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
219 |
+
# that there is an activated venv.
|
220 |
+
$env:VIRTUAL_ENV = $VenvDir
|
221 |
+
|
222 |
+
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
223 |
+
|
224 |
+
Write-Verbose "Setting prompt to '$Prompt'"
|
225 |
+
|
226 |
+
# Set the prompt to include the env name
|
227 |
+
# Make sure _OLD_VIRTUAL_PROMPT is global
|
228 |
+
function global:_OLD_VIRTUAL_PROMPT { "" }
|
229 |
+
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
230 |
+
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
231 |
+
|
232 |
+
function global:prompt {
|
233 |
+
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
234 |
+
_OLD_VIRTUAL_PROMPT
|
235 |
+
}
|
236 |
+
$env:VIRTUAL_ENV_PROMPT = $Prompt
|
237 |
+
}
|
238 |
+
|
239 |
+
# Clear PYTHONHOME
|
240 |
+
if (Test-Path -Path Env:PYTHONHOME) {
|
241 |
+
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
242 |
+
Remove-Item -Path Env:PYTHONHOME
|
243 |
+
}
|
244 |
+
|
245 |
+
# Add the venv to the PATH
|
246 |
+
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
247 |
+
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
venv/bin/accelerate
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from accelerate.commands.accelerate_cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/accelerate-estimate-memory
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from accelerate.commands.estimate import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/activate.fish
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file must be used with "source <venv>/bin/activate.fish" *from fish*
|
2 |
+
# (https://fishshell.com/); you cannot run it directly.
|
3 |
+
|
4 |
+
function deactivate -d "Exit virtual environment and return to normal shell environment"
|
5 |
+
# reset old environment variables
|
6 |
+
if test -n "$_OLD_VIRTUAL_PATH"
|
7 |
+
set -gx PATH $_OLD_VIRTUAL_PATH
|
8 |
+
set -e _OLD_VIRTUAL_PATH
|
9 |
+
end
|
10 |
+
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
11 |
+
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
12 |
+
set -e _OLD_VIRTUAL_PYTHONHOME
|
13 |
+
end
|
14 |
+
|
15 |
+
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
16 |
+
set -e _OLD_FISH_PROMPT_OVERRIDE
|
17 |
+
# prevents error when using nested fish instances (Issue #93858)
|
18 |
+
if functions -q _old_fish_prompt
|
19 |
+
functions -e fish_prompt
|
20 |
+
functions -c _old_fish_prompt fish_prompt
|
21 |
+
functions -e _old_fish_prompt
|
22 |
+
end
|
23 |
+
end
|
24 |
+
|
25 |
+
set -e VIRTUAL_ENV
|
26 |
+
set -e VIRTUAL_ENV_PROMPT
|
27 |
+
if test "$argv[1]" != "nondestructive"
|
28 |
+
# Self-destruct!
|
29 |
+
functions -e deactivate
|
30 |
+
end
|
31 |
+
end
|
32 |
+
|
33 |
+
# Unset irrelevant variables.
|
34 |
+
deactivate nondestructive
|
35 |
+
|
36 |
+
set -gx VIRTUAL_ENV "/mnt/weka/peacock/cronscript/venv"
|
37 |
+
|
38 |
+
set -gx _OLD_VIRTUAL_PATH $PATH
|
39 |
+
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
|
40 |
+
|
41 |
+
# Unset PYTHONHOME if set.
|
42 |
+
if set -q PYTHONHOME
|
43 |
+
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
44 |
+
set -e PYTHONHOME
|
45 |
+
end
|
46 |
+
|
47 |
+
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
48 |
+
# fish uses a function instead of an env var to generate the prompt.
|
49 |
+
|
50 |
+
# Save the current fish_prompt function as the function _old_fish_prompt.
|
51 |
+
functions -c fish_prompt _old_fish_prompt
|
52 |
+
|
53 |
+
# With the original prompt function renamed, we can override with our own.
|
54 |
+
function fish_prompt
|
55 |
+
# Save the return status of the last command.
|
56 |
+
set -l old_status $status
|
57 |
+
|
58 |
+
# Output the venv prompt; color taken from the blue of the Python logo.
|
59 |
+
printf "%s%s%s" (set_color 4B8BBE) "(venv) " (set_color normal)
|
60 |
+
|
61 |
+
# Restore the return status of the previous command.
|
62 |
+
echo "exit $old_status" | .
|
63 |
+
# Output the original/"old" prompt.
|
64 |
+
_old_fish_prompt
|
65 |
+
end
|
66 |
+
|
67 |
+
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
68 |
+
set -gx VIRTUAL_ENV_PROMPT "(venv) "
|
69 |
+
end
|
venv/bin/convert-caffe2-to-onnx
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from caffe2.python.onnx.bin.conversion import caffe2_to_onnx
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(caffe2_to_onnx())
|
venv/bin/convert-onnx-to-caffe2
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from caffe2.python.onnx.bin.conversion import onnx_to_caffe2
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(onnx_to_caffe2())
|
venv/bin/cpuinfo
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from cpuinfo import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/datasets-cli
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from datasets.commands.datasets_cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/deepspeed
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
|
3 |
+
from deepspeed.launcher.runner import main
|
4 |
+
|
5 |
+
if __name__ == '__main__':
|
6 |
+
main()
|
venv/bin/ds
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
|
3 |
+
from deepspeed.launcher.runner import main
|
4 |
+
|
5 |
+
if __name__ == '__main__':
|
6 |
+
main()
|
venv/bin/ds_elastic
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
|
3 |
+
import argparse
|
4 |
+
import json
|
5 |
+
|
6 |
+
import deepspeed
|
7 |
+
from deepspeed.elasticity import compute_elastic_config
|
8 |
+
|
9 |
+
if __name__ == '__main__':
|
10 |
+
parser = argparse.ArgumentParser()
|
11 |
+
parser.add_argument('-c', '--config', type=str, help="DeepSpeed config json")
|
12 |
+
parser.add_argument('-w', '--world-size', type=int, default=0, help="Intended/current world size")
|
13 |
+
args = parser.parse_args()
|
14 |
+
ds_config = json.load(open(args.config, 'r'))
|
15 |
+
|
16 |
+
ds_version = deepspeed.__version__
|
17 |
+
|
18 |
+
elastic_config = ds_config['elasticity']
|
19 |
+
print('------------------------------------------')
|
20 |
+
print("Elasticity config:")
|
21 |
+
print('------------------------------------------')
|
22 |
+
print(json.dumps(elastic_config, indent=4, sort_keys=True))
|
23 |
+
|
24 |
+
if args.world_size > 0:
|
25 |
+
final_batch_size, valid_gpus, micro_batch_size = compute_elastic_config(ds_config=ds_config,
|
26 |
+
target_deepspeed_version=ds_version,
|
27 |
+
world_size=args.world_size)
|
28 |
+
print('------------------------------------------')
|
29 |
+
print(f"Calculated results for world size {args.world_size}:")
|
30 |
+
print('------------------------------------------')
|
31 |
+
print(f'final_batch_size .... {final_batch_size}')
|
32 |
+
print(f'valid_gpus .......... {valid_gpus}')
|
33 |
+
print(f'micro_batch_size .... {micro_batch_size}')
|
34 |
+
else:
|
35 |
+
final_batch_size, valid_gpus = compute_elastic_config(ds_config=ds_config, target_deepspeed_version=ds_version)
|
36 |
+
print('------------------------------------------')
|
37 |
+
print("Calculated results:")
|
38 |
+
print('------------------------------------------')
|
39 |
+
print(f'final_batch_size .... {final_batch_size}')
|
40 |
+
print(f'valid_gpus .......... {valid_gpus}')
|
venv/bin/ds_ssh
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Copyright 2020 The Microsoft DeepSpeed Team
|
4 |
+
|
5 |
+
command -v pdsh
|
6 |
+
if [ $? != 0 ]; then
|
7 |
+
echo "Cannot find pdsh, please install via 'apt-get install -y pdsh'"
|
8 |
+
exit 1
|
9 |
+
fi
|
10 |
+
|
11 |
+
hostfile=/job/hostfile
|
12 |
+
|
13 |
+
while getopts "h?f:" opt; do
|
14 |
+
case "$opt" in
|
15 |
+
h|\?)
|
16 |
+
echo "-f <hostfile>: specify a hostfile, defaults to /job/hostfile"
|
17 |
+
exit 0
|
18 |
+
;;
|
19 |
+
f)
|
20 |
+
hostfile=$OPTARG
|
21 |
+
shift $((OPTIND-1))
|
22 |
+
;;
|
23 |
+
esac
|
24 |
+
done
|
25 |
+
|
26 |
+
echo "hostfile=$hostfile"
|
27 |
+
|
28 |
+
if [ -f $hostfile ]; then
|
29 |
+
hosts=`cat $hostfile | awk '{print $1}' | paste -sd "," -`
|
30 |
+
export PDSH_RCMD_TYPE=ssh
|
31 |
+
pdsh -w ${hosts} $@
|
32 |
+
else
|
33 |
+
echo "Missing hostfile at ${hostfile}, unable to proceed"
|
34 |
+
fi
|
venv/bin/dsr
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
|
3 |
+
from deepspeed.env_report import cli_main
|
4 |
+
|
5 |
+
if __name__ == '__main__':
|
6 |
+
cli_main()
|
venv/bin/evaluate-cli
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from evaluate.commands.evaluate_cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/f2py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from numpy.f2py.f2py2e import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/get_gprof
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
#
|
3 |
+
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
|
4 |
+
# Copyright (c) 2008-2016 California Institute of Technology.
|
5 |
+
# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation.
|
6 |
+
# License: 3-clause BSD. The full license text is available at:
|
7 |
+
# - https://github.com/uqfoundation/dill/blob/master/LICENSE
|
8 |
+
'''
|
9 |
+
build profile graph for the given instance
|
10 |
+
|
11 |
+
running:
|
12 |
+
$ get_gprof <args> <instance>
|
13 |
+
|
14 |
+
executes:
|
15 |
+
gprof2dot -f pstats <args> <type>.prof | dot -Tpng -o <type>.call.png
|
16 |
+
|
17 |
+
where:
|
18 |
+
<args> are arguments for gprof2dot, such as "-n 5 -e 5"
|
19 |
+
<instance> is code to create the instance to profile
|
20 |
+
<type> is the class of the instance (i.e. type(instance))
|
21 |
+
|
22 |
+
For example:
|
23 |
+
$ get_gprof -n 5 -e 1 "import numpy; numpy.array([1,2])"
|
24 |
+
|
25 |
+
will create 'ndarray.call.png' with the profile graph for numpy.array([1,2]),
|
26 |
+
where '-n 5' eliminates nodes below 5% threshold, similarly '-e 1' eliminates
|
27 |
+
edges below 1% threshold
|
28 |
+
'''
|
29 |
+
|
30 |
+
if __name__ == "__main__":
|
31 |
+
import sys
|
32 |
+
if len(sys.argv) < 2:
|
33 |
+
print ("Please provide an object instance (e.g. 'import math; math.pi')")
|
34 |
+
sys.exit()
|
35 |
+
# grab args for gprof2dot
|
36 |
+
args = sys.argv[1:-1]
|
37 |
+
args = ' '.join(args)
|
38 |
+
# last arg builds the object
|
39 |
+
obj = sys.argv[-1]
|
40 |
+
obj = obj.split(';')
|
41 |
+
# multi-line prep for generating an instance
|
42 |
+
for line in obj[:-1]:
|
43 |
+
exec(line)
|
44 |
+
# one-line generation of an instance
|
45 |
+
try:
|
46 |
+
obj = eval(obj[-1])
|
47 |
+
except Exception:
|
48 |
+
print ("Error processing object instance")
|
49 |
+
sys.exit()
|
50 |
+
|
51 |
+
# get object 'name'
|
52 |
+
objtype = type(obj)
|
53 |
+
name = getattr(objtype, '__name__', getattr(objtype, '__class__', objtype))
|
54 |
+
|
55 |
+
# profile dumping an object
|
56 |
+
import dill
|
57 |
+
import os
|
58 |
+
import cProfile
|
59 |
+
#name = os.path.splitext(os.path.basename(__file__))[0]
|
60 |
+
cProfile.run("dill.dumps(obj)", filename="%s.prof" % name)
|
61 |
+
msg = "gprof2dot -f pstats %s %s.prof | dot -Tpng -o %s.call.png" % (args, name, name)
|
62 |
+
try:
|
63 |
+
res = os.system(msg)
|
64 |
+
except Exception:
|
65 |
+
print ("Please verify install of 'gprof2dot' to view profile graphs")
|
66 |
+
if res:
|
67 |
+
print ("Please verify install of 'gprof2dot' to view profile graphs")
|
68 |
+
|
69 |
+
# get stats
|
70 |
+
f_prof = "%s.prof" % name
|
71 |
+
import pstats
|
72 |
+
stats = pstats.Stats(f_prof, stream=sys.stdout)
|
73 |
+
stats.strip_dirs().sort_stats('cumtime')
|
74 |
+
stats.print_stats(20) #XXX: save to file instead of print top 20?
|
75 |
+
os.remove(f_prof)
|
venv/bin/get_objgraph
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
#
|
3 |
+
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
|
4 |
+
# Copyright (c) 2008-2016 California Institute of Technology.
|
5 |
+
# Copyright (c) 2016-2024 The Uncertainty Quantification Foundation.
|
6 |
+
# License: 3-clause BSD. The full license text is available at:
|
7 |
+
# - https://github.com/uqfoundation/dill/blob/master/LICENSE
|
8 |
+
"""
|
9 |
+
display the reference paths for objects in ``dill.types`` or a .pkl file
|
10 |
+
|
11 |
+
Notes:
|
12 |
+
the generated image is useful in showing the pointer references in
|
13 |
+
objects that are or can be pickled. Any object in ``dill.objects``
|
14 |
+
listed in ``dill.load_types(picklable=True, unpicklable=True)`` works.
|
15 |
+
|
16 |
+
Examples::
|
17 |
+
|
18 |
+
$ get_objgraph ArrayType
|
19 |
+
Image generated as ArrayType.png
|
20 |
+
"""
|
21 |
+
|
22 |
+
import dill as pickle
|
23 |
+
#pickle.debug.trace(True)
|
24 |
+
#import pickle
|
25 |
+
|
26 |
+
# get all objects for testing
|
27 |
+
from dill import load_types
|
28 |
+
load_types(pickleable=True,unpickleable=True)
|
29 |
+
from dill import objects
|
30 |
+
|
31 |
+
if __name__ == "__main__":
|
32 |
+
import sys
|
33 |
+
if len(sys.argv) != 2:
|
34 |
+
print ("Please provide exactly one file or type name (e.g. 'IntType')")
|
35 |
+
msg = "\n"
|
36 |
+
for objtype in list(objects.keys())[:40]:
|
37 |
+
msg += objtype + ', '
|
38 |
+
print (msg + "...")
|
39 |
+
else:
|
40 |
+
objtype = str(sys.argv[-1])
|
41 |
+
try:
|
42 |
+
obj = objects[objtype]
|
43 |
+
except KeyError:
|
44 |
+
obj = pickle.load(open(objtype,'rb'))
|
45 |
+
import os
|
46 |
+
objtype = os.path.splitext(objtype)[0]
|
47 |
+
try:
|
48 |
+
import objgraph
|
49 |
+
objgraph.show_refs(obj, filename=objtype+'.png')
|
50 |
+
except ImportError:
|
51 |
+
print ("Please install 'objgraph' to view object graphs")
|
52 |
+
|
53 |
+
|
54 |
+
# EOF
|
venv/bin/huggingface-cli
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from huggingface_hub.commands.huggingface_cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/lm-eval
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from lm_eval.__main__ import cli_evaluate
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(cli_evaluate())
|
venv/bin/ninja
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from ninja import ninja
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(ninja())
|
venv/bin/normalizer
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from charset_normalizer.cli import cli_detect
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(cli_detect())
|
venv/bin/pip3
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from pip._internal.cli.main import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/pip3.10
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from pip._internal.cli.main import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/pybind11-config
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from pybind11.__main__ import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/sacrebleu
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from sacrebleu.sacrebleu import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
venv/bin/tabulate
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/mnt/weka/peacock/cronscript/venv/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from tabulate import _main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(_main())
|
venv/lib/python3.10/site-packages/sympy/plotting/tests/test_region_not.png
ADDED
![]() |
Git LFS Details
|
venv/lib/python3.10/site-packages/torch/bin/protoc
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3390873b2da56c1397adec3728f1588c51e182f15b123d3b4d4f248d31c1f4da
|
3 |
+
size 5330888
|
venv/lib/python3.10/site-packages/torch/bin/protoc-3.13.0.0
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3390873b2da56c1397adec3728f1588c51e182f15b123d3b4d4f248d31c1f4da
|
3 |
+
size 5330888
|
venv/lib/python3.10/site-packages/transformers/models/clipseg/__init__.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2022 The HuggingFace Team. All rights reserved.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
from typing import TYPE_CHECKING
|
15 |
+
|
16 |
+
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
|
17 |
+
|
18 |
+
|
19 |
+
_import_structure = {
|
20 |
+
"configuration_clipseg": [
|
21 |
+
"CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP",
|
22 |
+
"CLIPSegConfig",
|
23 |
+
"CLIPSegTextConfig",
|
24 |
+
"CLIPSegVisionConfig",
|
25 |
+
],
|
26 |
+
"processing_clipseg": ["CLIPSegProcessor"],
|
27 |
+
}
|
28 |
+
|
29 |
+
try:
|
30 |
+
if not is_torch_available():
|
31 |
+
raise OptionalDependencyNotAvailable()
|
32 |
+
except OptionalDependencyNotAvailable:
|
33 |
+
pass
|
34 |
+
else:
|
35 |
+
_import_structure["modeling_clipseg"] = [
|
36 |
+
"CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST",
|
37 |
+
"CLIPSegModel",
|
38 |
+
"CLIPSegPreTrainedModel",
|
39 |
+
"CLIPSegTextModel",
|
40 |
+
"CLIPSegVisionModel",
|
41 |
+
"CLIPSegForImageSegmentation",
|
42 |
+
]
|
43 |
+
|
44 |
+
if TYPE_CHECKING:
|
45 |
+
from .configuration_clipseg import (
|
46 |
+
CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP,
|
47 |
+
CLIPSegConfig,
|
48 |
+
CLIPSegTextConfig,
|
49 |
+
CLIPSegVisionConfig,
|
50 |
+
)
|
51 |
+
from .processing_clipseg import CLIPSegProcessor
|
52 |
+
|
53 |
+
try:
|
54 |
+
if not is_torch_available():
|
55 |
+
raise OptionalDependencyNotAvailable()
|
56 |
+
except OptionalDependencyNotAvailable:
|
57 |
+
pass
|
58 |
+
else:
|
59 |
+
from .modeling_clipseg import (
|
60 |
+
CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST,
|
61 |
+
CLIPSegForImageSegmentation,
|
62 |
+
CLIPSegModel,
|
63 |
+
CLIPSegPreTrainedModel,
|
64 |
+
CLIPSegTextModel,
|
65 |
+
CLIPSegVisionModel,
|
66 |
+
)
|
67 |
+
|
68 |
+
else:
|
69 |
+
import sys
|
70 |
+
|
71 |
+
sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
|