2023-10-07 11:49:40 +08:00
# Installation
2024-08-22 14:48:45 +08:00
## Basic Installation
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
1. Prepare the OpenCompass runtime environment using Conda:
2023-11-22 19:16:54 +08:00
2024-08-22 14:48:45 +08:00
```conda create --name opencompass python=3.10 -y
# conda create --name opencompass_lmdeploy python=3.10 -y
2023-10-07 11:49:40 +08:00
2023-11-22 19:16:54 +08:00
conda activate opencompass
2024-08-22 14:48:45 +08:00
```
2023-11-22 19:16:54 +08:00
2024-08-22 14:48:45 +08:00
If you want to customize the PyTorch version or related CUDA version, please refer to the [official documentation ](https://pytorch.org/get-started/locally/ ) to set up the PyTorch environment. Note that OpenCompass requires `pytorch>=1.13` .
2023-11-22 19:16:54 +08:00
2023-10-07 11:49:40 +08:00
2. Install OpenCompass:
2024-08-22 14:48:45 +08:00
- pip Installation
```bash
# For support of most datasets and models
pip install -U opencompass
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
# Complete installation (supports more datasets)
# pip install "opencompass[full]"
# API Testing (e.g., OpenAI, Qwen)
# pip install "opencompass[api]"
```
- Building from Source Code If you want to use the latest features of OpenCompass
2023-10-07 11:49:40 +08:00
```bash
2024-08-22 14:48:45 +08:00
git clone https://github.com/open-compass/opencompass opencompass
2023-10-07 11:49:40 +08:00
cd opencompass
pip install -e .
```
2024-08-22 14:48:45 +08:00
## Other Installations
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
### Inference Backends
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
```bash
# Model inference backends. Since these backends often have dependency conflicts,
# we recommend using separate virtual environments to manage them.
pip install "opencompass[lmdeploy]"
# pip install "opencompass[vllm]"
```
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
- LMDeploy
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
You can check if the inference backend has been installed successfully with the following command. For more information, refer to the [official documentation ](https://lmdeploy.readthedocs.io/en/latest/get_started.html )
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
```bash
lmdeploy chat internlm/internlm2_5-1_8b-chat --backend turbomind
```
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
- vLLM
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
You can check if the inference backend has been installed successfully with the following command. For more information, refer to the [official documentation ](https://docs.vllm.ai/en/latest/getting_started/quickstart.html )
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
```bash
vllm serve facebook/opt-125m
```
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
### API
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
OpenCompass supports different commercial model API calls, which you can install via pip or by referring to the [API dependencies ](https://github.com/open-compass/opencompass/blob/main/requirements/api.txt ) for specific API model dependencies.
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
```bash
2025-01-17 11:08:09 +08:00
pip install "opencompass[api]"
2023-10-07 11:49:40 +08:00
2024-08-22 14:48:45 +08:00
# pip install openai # GPT-3.5-Turbo / GPT-4-Turbo / GPT-4 / GPT-4o (API)
# pip install anthropic # Claude (API)
# pip install dashscope # Qwen (API)
# pip install volcengine-python-sdk # ByteDance Volcano Engine (API)
# ...
```
2024-03-28 16:49:04 +08:00
2024-08-22 14:48:45 +08:00
### Datasets
2024-03-28 16:49:04 +08:00
2024-08-22 14:48:45 +08:00
The basic installation supports most fundamental datasets. For certain datasets (e.g., Alpaca-eval, Longbench, etc.), additional dependencies need to be installed.
2024-03-28 16:49:04 +08:00
2024-08-22 14:48:45 +08:00
You can install these through pip or refer to the [additional dependencies ](<(https://github.com/open-compass/opencompass/blob/main/requirements/extra.txt )>) for specific dependencies.
```bash
2025-01-17 11:08:09 +08:00
pip install "opencompass[full]"
2024-08-22 14:48:45 +08:00
```
For HumanEvalX / HumanEval+ / MBPP+, you need to manually clone the Git repository and install it.
```bash
git clone --recurse-submodules git@github.com:open-compass/human-eval.git
cd human-eval
pip install -e .
pip install -e evalplus
```
Some agent evaluations require installing numerous dependencies, which may conflict with existing runtime environments. We recommend creating separate conda environments to manage these.
2024-03-28 16:49:04 +08:00
2024-08-22 14:48:45 +08:00
```bash
# T-Eval
pip install lagent==0.1.2
# CIBench
pip install -r requirements/agent.txt
```
2024-03-28 16:49:04 +08:00
2023-10-07 11:49:40 +08:00
# Dataset Preparation
[Feature] Support ModelScope datasets (#1289)
* add ceval, gsm8k modelscope surpport
* update race, mmlu, arc, cmmlu, commonsenseqa, humaneval and unittest
* update bbh, flores, obqa, siqa, storycloze, summedits, winogrande, xsum datasets
* format file
* format file
* update dataset format
* support ms_dataset
* udpate dataset for modelscope support
* merge myl_dev and update test_ms_dataset
* udpate dataset for modelscope support
* update readme
* update eval_api_zhipu_v2
* remove unused code
* add get_data_path function
* update readme
* remove tydiqa japanese subset
* add ceval, gsm8k modelscope surpport
* update race, mmlu, arc, cmmlu, commonsenseqa, humaneval and unittest
* update bbh, flores, obqa, siqa, storycloze, summedits, winogrande, xsum datasets
* format file
* format file
* update dataset format
* support ms_dataset
* udpate dataset for modelscope support
* merge myl_dev and update test_ms_dataset
* update readme
* udpate dataset for modelscope support
* update eval_api_zhipu_v2
* remove unused code
* add get_data_path function
* remove tydiqa japanese subset
* update util
* remove .DS_Store
* fix md format
* move util into package
* update docs/get_started.md
* restore eval_api_zhipu_v2.py, add environment setting
* Update dataset
* Update
* Update
* Update
* Update
---------
Co-authored-by: Yun lin <yunlin@U-Q9X2K4QV-1904.local>
Co-authored-by: Yunnglin <mao.looper@qq.com>
Co-authored-by: Yun lin <yunlin@laptop.local>
Co-authored-by: Yunnglin <maoyl@smail.nju.edu.cn>
Co-authored-by: zhangsongyang <zhangsongyang@pjlab.org.cn>
2024-07-29 13:48:32 +08:00
The datasets supported by OpenCompass mainly include three parts:
2023-10-07 11:49:40 +08:00
1. Huggingface datasets: The [Huggingface Datasets ](https://huggingface.co/datasets ) provide a large number of datasets, which will **automatically download** when running with this option.
[Feature] Support ModelScope datasets (#1289)
* add ceval, gsm8k modelscope surpport
* update race, mmlu, arc, cmmlu, commonsenseqa, humaneval and unittest
* update bbh, flores, obqa, siqa, storycloze, summedits, winogrande, xsum datasets
* format file
* format file
* update dataset format
* support ms_dataset
* udpate dataset for modelscope support
* merge myl_dev and update test_ms_dataset
* udpate dataset for modelscope support
* update readme
* update eval_api_zhipu_v2
* remove unused code
* add get_data_path function
* update readme
* remove tydiqa japanese subset
* add ceval, gsm8k modelscope surpport
* update race, mmlu, arc, cmmlu, commonsenseqa, humaneval and unittest
* update bbh, flores, obqa, siqa, storycloze, summedits, winogrande, xsum datasets
* format file
* format file
* update dataset format
* support ms_dataset
* udpate dataset for modelscope support
* merge myl_dev and update test_ms_dataset
* update readme
* udpate dataset for modelscope support
* update eval_api_zhipu_v2
* remove unused code
* add get_data_path function
* remove tydiqa japanese subset
* update util
* remove .DS_Store
* fix md format
* move util into package
* update docs/get_started.md
* restore eval_api_zhipu_v2.py, add environment setting
* Update dataset
* Update
* Update
* Update
* Update
---------
Co-authored-by: Yun lin <yunlin@U-Q9X2K4QV-1904.local>
Co-authored-by: Yunnglin <mao.looper@qq.com>
Co-authored-by: Yun lin <yunlin@laptop.local>
Co-authored-by: Yunnglin <maoyl@smail.nju.edu.cn>
Co-authored-by: zhangsongyang <zhangsongyang@pjlab.org.cn>
2024-07-29 13:48:32 +08:00
Translate the paragraph into English:
2. ModelScope Datasets: [ModelScope OpenCompass Dataset ](https://modelscope.cn/organization/opencompass ) supports automatic downloading of datasets from ModelScope.
To enable this feature, set the environment variable: `export DATASET_SOURCE=ModelScope` . The available datasets include (sourced from OpenCompassData-core.zip):
```plain
humaneval, triviaqa, commonsenseqa, tydiqa, strategyqa, cmmlu, lambada, piqa, ceval, math, LCSTS, Xsum, winogrande, openbookqa, AGIEval, gsm8k, nq, race, siqa, mbpp, mmlu, hellaswag, ARC, BBH, xstory_cloze, summedits, GAOKAO-BENCH, OCNLI, cmnli
```
3. Custom dataset: OpenCompass also provides some Chinese custom **self-built** datasets. Please run the following command to **manually download and extract** them.
2023-10-07 11:49:40 +08:00
Run the following commands to download and place the datasets in the `${OpenCompass}/data` directory can complete dataset preparation.
```bash
# Run in the OpenCompass directory
2024-02-28 10:54:04 +08:00
wget https://github.com/open-compass/opencompass/releases/download/0.2.2.rc1/OpenCompassData-core-20240207.zip
unzip OpenCompassData-core-20240207.zip
2023-10-07 11:49:40 +08:00
```
2024-01-08 14:23:35 +08:00
If you need to use the more comprehensive dataset (~500M) provided by OpenCompass, You can download and `unzip` it using the following command:
2023-11-13 13:00:37 +08:00
```bash
2024-02-28 10:54:04 +08:00
wget https://github.com/open-compass/opencompass/releases/download/0.2.2.rc1/OpenCompassData-complete-20240207.zip
unzip OpenCompassData-complete-20240207.zip
2023-11-13 13:00:37 +08:00
cd ./data
2024-03-15 13:44:46 +08:00
find . -name "*.zip" -exec unzip "{}" \;
2023-11-13 13:00:37 +08:00
```
2024-02-28 10:54:04 +08:00
The list of datasets included in both `.zip` can be found [here ](https://github.com/open-compass/opencompass/releases/tag/0.2.2.rc1 )
2023-11-13 13:00:37 +08:00
2023-10-07 11:49:40 +08:00
OpenCompass has supported most of the datasets commonly used for performance comparison, please refer to `configs/dataset` for the specific list of supported datasets.
For next step, please read [Quick Start ](./quick_start.md ).