Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Update contribution guide & toc, improve user experience #188

Merged
merged 6 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ Make sure you have installed OpenCompass correctly and prepared your datasets ac

For more tutorials, please check our [Documentation](https://opencompass.readthedocs.io/en/latest/index.html).

## 👷‍♂️ Contributing

We appreciate all contributions to improve OpenCompass. Please refer to the [contributing guideline](https://opencompass.readthedocs.io/en/latest/notes/contribution_guide.html) for the best practice.

## 🤝 Acknowledgements

Some code in this project is cited and modified from [OpenICL](https://github.com/Shark-NLP/OpenICL).
Expand Down
4 changes: 4 additions & 0 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ unzip OpenCompassData.zip

更多教程请查看我们的[文档](https://opencompass.readthedocs.io/zh_CN/latest/index.html)。

## 👷‍♂️ 贡献

我们感谢所有的贡献者为改进和提升 OpenCompass 所作出的努力。请参考[贡献指南](https://opencompass.readthedocs.io/zh_CN/latest/notes/contribution_guide.html)来了解参与项目贡献的相关指引。

## 🤝 致谢

该项目部分的代码引用并修改自 [OpenICL](https://github.com/Shark-NLP/OpenICL)。
Expand Down
2 changes: 1 addition & 1 deletion docs/en/_static/js/custom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var collapsedSections = ['Advanced Guides', 'Tools', 'User Guides', 'Notes'];
var collapsedSections = [];

$(document).ready(function () {
$('.model-summary').DataTable({
Expand Down
4 changes: 2 additions & 2 deletions docs/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ We always welcome *PRs* and *Issues* for the betterment of OpenCompass.
:maxdepth: 1
:caption: Prompt

prompt/few_shot.md
prompt/chain_of_thought.md
prompt/overview.md
prompt/prompt_template.md
prompt/meta_template.md
prompt/chain_of_thought.md

.. _Tools:
.. toctree::
Expand Down
137 changes: 104 additions & 33 deletions docs/en/notes/contribution_guide.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,125 @@
# Contributing to OpenCompass

- [Contributing to OpenCompass](#contributing-to-opencompass)
- [Workflow](#workflow)
- [What is PR](#what-is-pr)
- [Basic Workflow](#basic-workflow)
- [Procedures in detail](#procedures-in-detail)
- [1. Get the most recent codebase](#1-get-the-most-recent-codebase)
- [2. Checkout a new branch from `main` branch](#2-checkout-a-new-branch-from-main-branch)
- [3. Commit your changes](#3-commit-your-changes)
- [4. Push your changes to the forked repository and create a PR](#4-push-your-changes-to-the-forked-repository-and-create-a-pr)
- [5. Discuss and review your code](#5-discuss-and-review-your-code)
- [6. Merge your branch to `main` branch and delete the branch](#6--merge-your-branch-to-main-branch-and-delete-the-branch)
- [Code style](#code-style)
- [Python](#python)
- [Pre-commit Hook](#pre-commit-hook)

Thanks for your interest in contributing to OpenCompass! All kinds of contributions are welcome, including but not limited to the following.

- Fix typo or bugs
- Add documentation or translate the documentation into other languages
- Add new features and components

## Workflow
## What is PR

We recommend the potential contributors follow this workflow for contribution.
`PR` is the abbreviation of `Pull Request`. Here's the definition of `PR` in the [official document](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) of Github.

1. Fork and pull the latest OpenCompass repository, follow [get started](https://OpenCompass.readthedocs.io/en/latest/get_started.html) to setup the environment.
2. Checkout a new branch (**do not use the master or dev branch** for PRs)
```
Pull requests let you tell others about changes you have pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.
```

## Basic Workflow

1. Get the most recent codebase
2. Checkout a new branch from `main` branch.
3. Commit your changes ([Don't forget to use pre-commit hooks!](#3-commit-your-changes))
4. Push your changes and create a PR
5. Discuss and review your code
6. Merge your branch to `main` branch

## Procedures in detail

### 1. Get the most recent codebase

- When you work on your first PR

Fork the OpenCompass repository: click the **fork** button at the top right corner of Github page
![avatar](https://github.com/InternLM/opencompass/assets/22607038/851ed33d-02db-49c9-bf94-7c62eee89eb2)

Clone forked repository to local

```bash
git clone git@github.com:XXX/opencompass.git
```

Add source repository to upstream

```bash
git remote add upstream git@github.com:InternLM/opencompass.git
```

- After your first PR

Checkout the latest branch of the local repository and pull the latest branch of the source repository.

```bash
git checkout main
git pull upstream main
```

### 2. Checkout a new branch from `main` branch

```bash
git checkout -b xxxx # xxxx is the name of new branch
git checkout main -b branchname
```

3. Edit the related files follow the code style mentioned below
4. Use [pre-commit hook](https://pre-commit.com/) to check and format your changes.
5. Commit your changes
6. Create a PR with related information
### 3. Commit your changes

- If you are a first-time contributor, please install and initialize pre-commit hooks from the repository root directory first.

```bash
pip install -U pre-commit
pre-commit install
```

- Commit your changes as usual. Pre-commit hooks will be triggered to stylize your code before each commit.

```bash
# coding
git add [files]
git commit -m 'messages'
```

```{note}
Sometimes your code may be changed by pre-commit hooks. In this case, please remember to re-stage the modified files and commit again.
```

### 4. Push your changes to the forked repository and create a PR

- Push the branch to your forked remote repository

```bash
git push origin branchname
```

- Create a PR
![avatar](https://github.com/InternLM/opencompass/assets/22607038/08feb221-b145-4ea8-8e20-05f143081604)

- Revise PR message template to describe your motivation and modifications made in this PR. You can also link the related issue to the PR manually in the PR message (For more information, checkout the [official guidance](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)).

- You can also ask a specific person to review the changes you've proposed.

### 5. Discuss and review your code

- Modify your codes according to reviewers' suggestions and then push your changes.

### 6. Merge your branch to `main` branch and delete the branch

- After the PR is merged by the maintainer, you can delete the branch you created in your forked repository.

```bash
git branch -d branchname # delete local branch
git push origin --delete branchname # delete remote branch
```

## Code style

Expand All @@ -44,25 +137,3 @@ We use the following tools for linting and formatting:
- [docformatter](https://github.com/myint/docformatter): A formatter to format docstring.

Style configurations of yapf and isort can be found in [setup.cfg](https://github.com/open-mmlab/OpenCompass/blob/main/setup.cfg).

## Pre-commit Hook

We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `isort`, `trailing whitespaces`, `markdown files`,
fixes `end-of-files`, `double-quoted-strings`, `python-encoding-pragma`, `mixed-line-ending`, sorts `requirements.txt` automatically on every commit.
The config for a pre-commit hook is stored in [.pre-commit-config](xxxxxxx).

After you clone the repository, you will need to install initialize pre-commit hook.

```shell
pip install -U pre-commit
```

From the repository folder

```shell
pre-commit install
```

After this on every commit check code linters and formatter will be enforced.

> Before you create a PR, make sure that your code lints and is formatted by yapf.
2 changes: 2 additions & 0 deletions docs/en/prompt/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ In OpenCompass, we split the template into two parts: the data-side template and
The data-side template is referred to as [prompt_template](./prompt_template.md), which represents the process of converting the fields in the dataset into prompts.

The model-side template is referred to as [meta_template](./meta_template.md), which represents how the model transforms these prompts into its expected input.

We also offer some prompting examples regarding [Chain of Thought](./chain_of_thought.md).
2 changes: 1 addition & 1 deletion docs/zh_cn/_static/js/custom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var collapsedSections = ['Advanced Guides', 'Tools', 'User Guides', 'Notes'];
var collapsedSections = [];

$(document).ready(function () {
$('.model-summary').DataTable({
Expand Down
20 changes: 10 additions & 10 deletions docs/zh_cn/advanced_guides/evaluation_turbomind.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# 评测LMDeploy模型
# 评测 LMDeploy 模型

我们支持评测使用[LMDeploy](https://github.com/InternLM/lmdeploy)加速过的大语言模型。LMDeploy 由 MMDeploy 和 MMRazor 团队联合开发,是涵盖了 LLM 任务的全套轻量化、部署和服务解决方案。 **TurboMind** 是 LMDeploy 推出的高效推理引擎。OpenCompass 对 TurboMind 进行了适配,本教程将介绍如何使用 OpenCompass 来对 TurboMind 加速后的模型进行评测。
我们支持评测使用 [LMDeploy](https://github.com/InternLM/lmdeploy) 加速过的大语言模型。LMDeploy 由 MMDeploy 和 MMRazor 团队联合开发,是涵盖了 LLM 任务的全套轻量化、部署和服务解决方案。 **TurboMind** 是 LMDeploy 推出的高效推理引擎。OpenCompass 对 TurboMind 进行了适配,本教程将介绍如何使用 OpenCompass 来对 TurboMind 加速后的模型进行评测。

## 环境配置

### 安装OpenCompass
### 安装 OpenCompass

请根据OpenCompass[安装指南](https://opencompass.readthedocs.io/en/latest/get_started.html) 来安装算法库和准备数据集。
请根据 OpenCompass [安装指南](https://opencompass.readthedocs.io/en/latest/get_started.html) 来安装算法库和准备数据集。

### 安装LMDeploy
### 安装 LMDeploy

使用pip安装LMDeploy( python 3.8+)
使用 pip 安装 LMDeploy (python 3.8+)

```shell
pip install lmdeploy
```

## 评测

我们使用InternLM作为例子来介绍如何评测
我们使用 InternLM 作为例子来介绍如何评测。

### 第一步: 获取InternLM模型
### 第一步: 获取 InternLM 模型

```shell
# 1. Download InternLM model(or use the cached model's checkpoint)
Expand All @@ -46,10 +46,10 @@ python -m lmdeploy.turbomind.chat ./workspace

### 第三步: 评测转换后的模型

在OpenCompass项目文件执行
在 OpenCompass 项目目录执行

```shell
python run.py configs/eval_internlm_chat_7b_turbomind.py -w outputs/turbomind
```

当模型完成推理和指标计算后,我们便可获得模型的评测结果
当模型完成推理和指标计算后,我们便可获得模型的评测结果
4 changes: 2 additions & 2 deletions docs/zh_cn/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ OpenCompass 上手路线
:maxdepth: 1
:caption: 提示词

prompt/few_shot.md
prompt/chain_of_thought.md
prompt/overview.md
prompt/prompt_template.md
prompt/meta_template.md
prompt/chain_of_thought.md

.. _进阶教程:
.. toctree::
Expand Down
Loading