Skip to content

Commit 393efae

Browse files
doc: reformat contributing.md for better visualization on github (#1033)
## Summary <!--- This is a required section; please describe the main purpose of this proposed code change. ---> Current `contributing.md` is not properly rendered on github because of some syntax for `mkdocstrings` for docsite <details> <summary>Details</summary> <img width="886" height="674" alt="image" src="https://github.com/user-attachments/assets/9a19f250-ec40-4dfb-9594-e4ebd4ba292c" /> </details> This PR removes syntax that doesn't work on github for better readability on both github and docsite. <details> <summary>github</summary> <img width="883" height="818" alt="image" src="https://github.com/user-attachments/assets/57c922fd-5bae-4f00-82d2-102cad65830f" /> </details> <details> <summary>docsite</summary> <img width="1089" height="791" alt="image" src="https://github.com/user-attachments/assets/41838a32-98fd-4207-a12e-a95cfdd22935" /> </details> <!--- ## Details This is an optional section; is there anything specific that reviewers should be aware of? ---> ## Testing Done <!--- This is a required section; please describe how this change was tested. ---> <!-- Replace BLANK with your device type. For example, A100-80G-PCIe Complete the following tasks before sending your PR, and replace `[ ]` with `[x]` to indicate you have done them. --> - Hardware Type: <BLANK> - [ ] run `make test` to ensure correctness - [ ] run `make checkstyle` to ensure code style - [ ] run `make test-convergence` to ensure convergence --------- Signed-off-by: Tcc0403 <76503978+Tcc0403@users.noreply.github.com> Co-authored-by: Vaibhav Jindal <vaibhav.jndl@gmail.com>
1 parent b708f79 commit 393efae

File tree

1 file changed

+45
-57
lines changed

1 file changed

+45
-57
lines changed

docs/contributing.md

Lines changed: 45 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,65 @@
22

33
Thank you for your interest in contributing to Liger-Kernel! This guide will help you set up your development environment, add a new kernel, run tests, and submit a pull request (PR).
44

5-
!!! Note
6-
### Maintainers
7-
@ByronHsu(admin) @qingquansong @yundai424 @kvignesh1420 @lancerts @JasonZhu1313 @shimizust
5+
### Maintainers
6+
@ByronHsu(admin) @qingquansong @yundai424 @kvignesh1420 @lancerts @JasonZhu1313 @shimizust @vaibhavjindal @tcc0403 @momochen
87

98
## Interested in the ticket?
109

1110
Leave `#take` in the comment and tag the maintainer.
1211

1312
## Setting Up Your Development Environment
1413

15-
!!! Note
16-
1. **Clone the Repository**
17-
```sh
18-
git clone https://github.com/linkedin/Liger-Kernel.git
19-
cd Liger-Kernel
20-
```
21-
2. **Install Dependencies and Editable Package**
22-
```
23-
pip install . -e[dev]
24-
```
25-
If encounter error `no matches found: .[dev]`, please use
26-
```
27-
pip install -e .'[dev]'
28-
```
29-
30-
3. **Install pre-commit hooks using [`prek`](https://prek.j178.dev/), a `pre-commit` alternative built in rust**
31-
```
32-
prek install
33-
```
34-
Run pre-commit check without committing (`-a` is equivalent to `--all-files`)
35-
```
36-
prek run -a
37-
```
14+
1. **Clone the Repository**
15+
```sh
16+
git clone https://github.com/linkedin/Liger-Kernel.git
17+
cd Liger-Kernel
18+
```
19+
2. **Install Dependencies and Editable Package**
20+
```
21+
pip install . -e[dev]
22+
```
23+
If encounter error `no matches found: .[dev]`, please use
24+
```
25+
pip install -e .'[dev]'
26+
```
27+
3. **Install pre-commit hooks using [`prek`](https://prek.j178.dev/), a `pre-commit` alternative built in rust**
28+
```
29+
prek install
30+
```
31+
Run pre-commit check without committing (`-a` is equivalent to `--all-files`)
32+
```
33+
prek run -a
34+
```
3835

3936
## Structure
4037

41-
!!! Info
42-
### Source Code
38+
### Source Code
39+
- `ops/`: Core Triton operations.
40+
- `transformers/`: PyTorch `nn.Module` implementations built on Triton operations, compliant with the `transformers` API.
4341

44-
- `ops/`: Core Triton operations.
45-
- `transformers/`: PyTorch `nn.Module` implementations built on Triton operations, compliant with the `transformers` API.
42+
### Tests
4643

47-
### Tests
44+
- `transformers/`: Correctness tests for the Triton-based layers.
45+
- `convergence/`: Patches Hugging Face models with all kernels, runs multiple iterations, and compares weights, logits, and loss layer-by-layer.
4846

49-
- `transformers/`: Correctness tests for the Triton-based layers.
50-
- `convergence/`: Patches Hugging Face models with all kernels, runs multiple iterations, and compares weights, logits, and loss layer-by-layer.
47+
### Benchmark
5148

52-
### Benchmark
53-
54-
- `benchmark/`: Execution time and memory benchmarks compared to Hugging Face layers.
49+
- `benchmark/`: Execution time and memory benchmarks compared to Hugging Face layers.
5550

5651
## Adding support for a new model
5752
To get familiar with the folder structure, please refer [here](https://github.com/linkedin/Liger-Kernel?tab=readme-ov-file#structure.).
5853

59-
#### 1 Figure out the kernels that can be monkey-patched
60-
61-
a) Check the `src/liger_kernel/ops` directory to find the kernels that can be monkey-patched.
62-
63-
b) Kernels like Fused Linear Cross Entropy require a custom lce_forward function to allow monkey-patching. For adding kernels requiring a similar approach, ensure that you create the corresponding forward function in the `src/liger_kernel/transformers/model` directory.
64-
65-
#### 2 Monkey-patch the HuggingFace model
66-
67-
a) Add the monkey-patching code in the `src/liger_kernel/transformers/monkey_patch.py` file.
68-
69-
b) Ensure that the monkey-patching function is added to the `__init__.py` file in the `src/liger_kernel/transformers/` directory.
54+
1. **Figure out the kernels that can be monkey-patched**
55+
- Check the `src/liger_kernel/ops` directory to find the kernels that can be monkey-patched.
56+
- Kernels like Fused Linear Cross Entropy require a custom lce_forward function to allow monkey-patching. For adding kernels requiring a similar approach, ensure that you create the corresponding forward function in the `src/liger_kernel/transformers/model` directory.
7057

71-
#### 3 Add Unit Tests
58+
2. **Monkey-patch the HuggingFace model**
59+
- Add the monkey-patching code in the `src/liger_kernel/transformers/monkey_patch.py` file.
60+
- Ensure that the monkey-patching function is added to the `__init__.py` file in the `src/liger_kernel/transformers/` directory.
7261

73-
a) Create unit tests and convergence tests for the monkey-patched model in the tests directory. Ensure that your tests cover all functionalities of the monkey-patched model.
62+
3. **Add Unit Tests**
63+
- Create unit tests and convergence tests for the monkey-patched model in the tests directory. Ensure that your tests cover all functionalities of the monkey-patched model.
7464

7565
## Adding a New Kernel
7666
To get familiar with the folder structure, please refer [here](https://github.com/linkedin/Liger-Kernel?tab=readme-ov-file#structure.).
@@ -106,9 +96,7 @@ The `/benchmark` directory contains benchmarking scripts for the individual kern
10696
## Submit PR
10797
Fork the repo, copy and paste the successful test logs in the PR and submit the PR followed by the PR template (**[example PR](https://github.com/linkedin/Liger-Kernel/pull/21)**).
10898

109-
!!! Warning "Notice"
110-
As a contributor, you represent that the code you submit is your original work or that of your employer (in which case you represent you have the right to bind your employer).
111-
By submitting code, you (and, if applicable, your employer) are licensing the submitted code to LinkedIn and the open source community subject to the BSD 2-Clause license.
99+
> As a contributor, you represent that the code you submit is your original work or that of your employer (in which case you represent you have the right to bind your employer). By submitting code, you (and, if applicable, your employer) are licensing the submitted code to LinkedIn and the open source community subject to the BSD 2-Clause license.
112100
113101
#### Release (Maintainer only)
114102

@@ -118,9 +106,9 @@ Fork the repo, copy and paste the successful test logs in the PR and submit the
118106
4. Adding release note: Minimum requirement is to click the `Generate Release Notes` button that will automatically generates 1) changes included, 2) new contributors. It's good to add sections on top to highlight the important changes.
119107
5. New pip uploading will be triggered upon a new release. NOTE: Both pre-release and official release will trigger the workflow to build wheel and publish to pypi, so please be sure that step 1-3 are followed correctly!
120108

121-
!!! Note "Notes on version"
122-
Here we follow the [sematic versioning](https://semver.org/). Denote the version as `major.minor.patch`, we increment:
109+
### Notes on version
110+
Here we follow the [sematic versioning](https://semver.org/). Denote the version as `major.minor.patch`, we increment:
123111

124-
- Major version when there is backward incompatible change.
125-
- Minor version when there is new backward-compatible functionality.
126-
- Patch version for bug fixes.
112+
- Major version when there is backward incompatible change.
113+
- Minor version when there is new backward-compatible functionality.
114+
- Patch version for bug fixes.

0 commit comments

Comments
 (0)