You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Copy file name to clipboardExpand all lines: docs/contributing.md
+45-57Lines changed: 45 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,75 +2,65 @@
2
2
3
3
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).
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
+
```
38
35
39
36
## Structure
40
37
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.
43
41
44
-
- `ops/`: Core Triton operations.
45
-
- `transformers/`: PyTorch `nn.Module` implementations built on Triton operations, compliant with the `transformers` API.
42
+
### Tests
46
43
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.
48
46
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
51
48
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.
55
50
56
51
## Adding support for a new model
57
52
To get familiar with the folder structure, please refer [here](https://github.com/linkedin/Liger-Kernel?tab=readme-ov-file#structure.).
58
53
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.
70
57
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.
72
61
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.
74
64
75
65
## Adding a New Kernel
76
66
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
106
96
## Submit PR
107
97
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)**).
108
98
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.
112
100
113
101
#### Release (Maintainer only)
114
102
@@ -118,9 +106,9 @@ Fork the repo, copy and paste the successful test logs in the PR and submit the
118
106
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.
119
107
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!
120
108
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:
123
111
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.
0 commit comments