liger-kernel-nightly 0.4.0.dev20241107052928__py3-none-any.whl → 0.6.3.dev20251121010306__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of liger-kernel-nightly might be problematic. Click here for more details.
- liger_kernel/__init__.py +0 -0
- liger_kernel/chunked_loss/README.md +25 -0
- liger_kernel/chunked_loss/__init__.py +8 -0
- liger_kernel/chunked_loss/cosine_similarity_loss.py +136 -0
- liger_kernel/chunked_loss/cpo_loss.py +157 -0
- liger_kernel/chunked_loss/dpo_loss.py +229 -0
- liger_kernel/chunked_loss/functional.py +17 -0
- liger_kernel/chunked_loss/fused_linear_distillation.py +292 -0
- liger_kernel/chunked_loss/fused_linear_ppo.py +350 -0
- liger_kernel/chunked_loss/fused_linear_preference.py +433 -0
- liger_kernel/chunked_loss/fused_linear_unpaired_preference.py +341 -0
- liger_kernel/chunked_loss/grpo_loss.py +304 -0
- liger_kernel/chunked_loss/jsd_loss.py +200 -0
- liger_kernel/chunked_loss/kto_loss.py +210 -0
- liger_kernel/chunked_loss/orpo_loss.py +144 -0
- liger_kernel/chunked_loss/simpo_loss.py +165 -0
- liger_kernel/env_report.py +21 -4
- liger_kernel/ops/cross_entropy.py +235 -84
- liger_kernel/ops/dyt.py +157 -0
- liger_kernel/ops/experimental/embedding.py +1 -3
- liger_kernel/ops/experimental/mm_int8int2.py +3 -9
- liger_kernel/ops/fused_add_rms_norm.py +412 -0
- liger_kernel/ops/fused_linear_cross_entropy.py +197 -75
- liger_kernel/ops/fused_linear_jsd.py +17 -34
- liger_kernel/ops/fused_neighborhood_attention.py +1022 -0
- liger_kernel/ops/geglu.py +7 -18
- liger_kernel/ops/group_norm.py +305 -0
- liger_kernel/ops/grpo_loss.py +310 -0
- liger_kernel/ops/jsd.py +46 -21
- liger_kernel/ops/kl_div.py +23 -19
- liger_kernel/ops/layer_norm.py +150 -86
- liger_kernel/ops/llama4_rope.py +225 -0
- liger_kernel/ops/multi_token_attention.py +207 -0
- liger_kernel/ops/poly_norm.py +386 -0
- liger_kernel/ops/qwen2vl_mrope.py +222 -0
- liger_kernel/ops/rms_norm.py +314 -84
- liger_kernel/ops/rope.py +32 -34
- liger_kernel/ops/softmax.py +201 -0
- liger_kernel/ops/sparsemax.py +179 -0
- liger_kernel/ops/swiglu.py +5 -9
- liger_kernel/ops/tiled_mlp.py +136 -0
- liger_kernel/ops/tvd.py +207 -0
- liger_kernel/ops/utils.py +8 -4
- liger_kernel/transformers/__init__.py +199 -24
- liger_kernel/transformers/auto_model.py +6 -13
- liger_kernel/transformers/cross_entropy.py +33 -20
- liger_kernel/transformers/dyt.py +22 -0
- liger_kernel/transformers/experimental/__init__.py +5 -0
- liger_kernel/transformers/experimental/embedding.py +1 -3
- liger_kernel/transformers/fsdp.py +55 -0
- liger_kernel/transformers/functional.py +291 -13
- liger_kernel/transformers/fused_add_rms_norm.py +39 -0
- liger_kernel/transformers/fused_linear_cross_entropy.py +43 -14
- liger_kernel/transformers/fused_linear_jsd.py +1 -4
- liger_kernel/transformers/fused_neighborhood_attention.py +234 -0
- liger_kernel/transformers/geglu.py +1 -4
- liger_kernel/transformers/group_norm.py +50 -0
- liger_kernel/transformers/grpo_loss.py +98 -0
- liger_kernel/transformers/jsd.py +2 -7
- liger_kernel/transformers/kl_div.py +1 -3
- liger_kernel/transformers/layer_norm.py +3 -9
- liger_kernel/transformers/llama4_rope.py +93 -0
- liger_kernel/transformers/model/falcon_h1.py +122 -0
- liger_kernel/transformers/model/gemma.py +77 -77
- liger_kernel/transformers/model/gemma2.py +283 -0
- liger_kernel/transformers/model/gemma3.py +331 -0
- liger_kernel/transformers/model/glm4.py +141 -0
- liger_kernel/transformers/model/glm4v.py +163 -0
- liger_kernel/transformers/model/glm4v_moe.py +172 -0
- liger_kernel/transformers/model/internvl.py +157 -0
- liger_kernel/transformers/model/llama.py +128 -79
- liger_kernel/transformers/model/llama4.py +121 -0
- liger_kernel/transformers/model/llava.py +344 -0
- liger_kernel/transformers/model/loss_utils.py +95 -0
- liger_kernel/transformers/model/mistral.py +68 -64
- liger_kernel/transformers/model/mixtral.py +75 -91
- liger_kernel/transformers/model/mllama.py +63 -68
- liger_kernel/transformers/model/olmo2.py +141 -0
- liger_kernel/transformers/model/output_classes.py +147 -0
- liger_kernel/transformers/model/paligemma.py +432 -0
- liger_kernel/transformers/model/phi3.py +59 -213
- liger_kernel/transformers/model/qwen2.py +75 -72
- liger_kernel/transformers/model/qwen2_5_vl.py +163 -0
- liger_kernel/transformers/model/qwen2_vl.py +78 -98
- liger_kernel/transformers/model/qwen3.py +136 -0
- liger_kernel/transformers/model/qwen3_moe.py +152 -0
- liger_kernel/transformers/model/qwen3_next.py +146 -0
- liger_kernel/transformers/model/qwen3_vl.py +150 -0
- liger_kernel/transformers/model/qwen3_vl_moe.py +126 -0
- liger_kernel/transformers/model/smollm3.py +199 -0
- liger_kernel/transformers/model/smolvlm.py +158 -0
- liger_kernel/transformers/monkey_patch.py +2106 -289
- liger_kernel/transformers/multi_token_attention.py +64 -0
- liger_kernel/transformers/poly_norm.py +42 -0
- liger_kernel/transformers/qwen2vl_mrope.py +20 -0
- liger_kernel/transformers/rms_norm.py +57 -6
- liger_kernel/transformers/rope.py +45 -2
- liger_kernel/transformers/softmax.py +12 -0
- liger_kernel/transformers/sparsemax.py +16 -0
- liger_kernel/transformers/swiglu.py +23 -8
- liger_kernel/transformers/tiled_mlp.py +133 -0
- liger_kernel/transformers/trainer/__init__.py +4 -0
- liger_kernel/transformers/trainer/orpo_trainer.py +130 -0
- liger_kernel/transformers/tvd.py +13 -0
- liger_kernel/triton/__init__.py +1 -3
- liger_kernel/triton/monkey_patch.py +1 -3
- liger_kernel/utils.py +71 -0
- {liger_kernel_nightly-0.4.0.dev20241107052928.dist-info → liger_kernel_nightly-0.6.3.dev20251121010306.dist-info}/METADATA +150 -137
- liger_kernel_nightly-0.6.3.dev20251121010306.dist-info/RECORD +116 -0
- {liger_kernel_nightly-0.4.0.dev20241107052928.dist-info → liger_kernel_nightly-0.6.3.dev20251121010306.dist-info}/WHEEL +1 -1
- liger_kernel_nightly-0.4.0.dev20241107052928.dist-info/RECORD +0 -48
- {liger_kernel_nightly-0.4.0.dev20241107052928.dist-info → liger_kernel_nightly-0.6.3.dev20251121010306.dist-info}/LICENSE +0 -0
- {liger_kernel_nightly-0.4.0.dev20241107052928.dist-info → liger_kernel_nightly-0.6.3.dev20251121010306.dist-info}/NOTICE +0 -0
- {liger_kernel_nightly-0.4.0.dev20241107052928.dist-info → liger_kernel_nightly-0.6.3.dev20251121010306.dist-info}/top_level.txt +0 -0
liger_kernel/utils.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
try:
|
|
2
|
+
import peft # noqa: F401
|
|
3
|
+
|
|
4
|
+
PEFT_AVAILABLE = True
|
|
5
|
+
except ImportError:
|
|
6
|
+
PEFT_AVAILABLE = False
|
|
7
|
+
|
|
8
|
+
import torch
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def is_peft_available():
|
|
12
|
+
return PEFT_AVAILABLE
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def infer_device():
|
|
16
|
+
"""
|
|
17
|
+
Get current device name based on available devices
|
|
18
|
+
"""
|
|
19
|
+
if torch.cuda.is_available(): # Works for both Nvidia and AMD
|
|
20
|
+
return "cuda"
|
|
21
|
+
elif torch.xpu.is_available():
|
|
22
|
+
return "xpu"
|
|
23
|
+
else:
|
|
24
|
+
return "cpu"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def transformers_version_dispatch(
|
|
28
|
+
required_version: str,
|
|
29
|
+
before_fn,
|
|
30
|
+
after_fn,
|
|
31
|
+
before_args: tuple = (),
|
|
32
|
+
after_args: tuple = (),
|
|
33
|
+
before_kwargs: dict = None,
|
|
34
|
+
after_kwargs: dict = None,
|
|
35
|
+
):
|
|
36
|
+
"""
|
|
37
|
+
Dispatches to different functions based on package version comparison.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
required_version: Version to compare against (e.g. "4.48.0")
|
|
41
|
+
before_fn: Function to call if package_version < required_version
|
|
42
|
+
after_fn: Function to call if package_version >= required_version
|
|
43
|
+
before_args: Positional arguments for before_fn
|
|
44
|
+
after_args: Positional arguments for after_fn
|
|
45
|
+
before_kwargs: Keyword arguments for before_fn
|
|
46
|
+
after_kwargs: Keyword arguments for after_fn
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
Result from either before_fn or after_fn
|
|
50
|
+
|
|
51
|
+
Example:
|
|
52
|
+
>>> rotary_emb = transformers_version_dispatch(
|
|
53
|
+
... "4.48.0",
|
|
54
|
+
... LlamaRotaryEmbedding,
|
|
55
|
+
... LlamaRotaryEmbedding,
|
|
56
|
+
... before_args=(head_dim,),
|
|
57
|
+
... after_args=(LlamaConfig(head_dim=head_dim),),
|
|
58
|
+
... before_kwargs={'device': device},
|
|
59
|
+
... after_kwargs={'device': device}
|
|
60
|
+
... )
|
|
61
|
+
"""
|
|
62
|
+
from packaging import version
|
|
63
|
+
from transformers import __version__ as transformers_version
|
|
64
|
+
|
|
65
|
+
before_kwargs = before_kwargs or {}
|
|
66
|
+
after_kwargs = after_kwargs or {}
|
|
67
|
+
|
|
68
|
+
if version.parse(transformers_version) < version.parse(required_version):
|
|
69
|
+
return before_fn(*before_args, **before_kwargs)
|
|
70
|
+
else:
|
|
71
|
+
return after_fn(*after_args, **after_kwargs)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: liger_kernel_nightly
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.3.dev20251121010306
|
|
4
4
|
Summary: Efficient Triton kernels for LLM Training
|
|
5
5
|
License: BSD 2-CLAUSE LICENSE
|
|
6
6
|
Copyright 2024 LinkedIn Corporation
|
|
@@ -33,17 +33,18 @@ License-File: NOTICE
|
|
|
33
33
|
Requires-Dist: torch>=2.1.2
|
|
34
34
|
Requires-Dist: triton>=2.3.1
|
|
35
35
|
Provides-Extra: dev
|
|
36
|
-
Requires-Dist: transformers>=4.
|
|
36
|
+
Requires-Dist: transformers>=4.49.0; extra == "dev"
|
|
37
37
|
Requires-Dist: matplotlib>=3.7.2; extra == "dev"
|
|
38
|
-
Requires-Dist:
|
|
39
|
-
Requires-Dist: black>=24.4.2; extra == "dev"
|
|
40
|
-
Requires-Dist: isort>=5.13.2; extra == "dev"
|
|
38
|
+
Requires-Dist: ruff>=0.12.0; extra == "dev"
|
|
41
39
|
Requires-Dist: pytest>=7.1.2; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
43
|
+
Requires-Dist: pytest-rerunfailures; extra == "dev"
|
|
42
44
|
Requires-Dist: datasets>=2.19.2; extra == "dev"
|
|
43
|
-
Requires-Dist: torchvision>=0.16.2; extra == "dev"
|
|
44
45
|
Requires-Dist: seaborn; extra == "dev"
|
|
45
|
-
|
|
46
|
-
Requires-Dist:
|
|
46
|
+
Requires-Dist: mkdocs-material; extra == "dev"
|
|
47
|
+
Requires-Dist: torchvision>=0.20; extra == "dev"
|
|
47
48
|
|
|
48
49
|
<a name="readme-top"></a>
|
|
49
50
|
|
|
@@ -55,7 +56,6 @@ Requires-Dist: transformers~=4.0; extra == "transformers"
|
|
|
55
56
|
<th style="padding: 10px;" colspan="2">Stable</th>
|
|
56
57
|
<th style="padding: 10px;" colspan="2">Nightly</th>
|
|
57
58
|
<th style="padding: 10px;">Discord</th>
|
|
58
|
-
<th style="padding: 10px;">Gurubase (experimental)</th>
|
|
59
59
|
</tr>
|
|
60
60
|
<tr>
|
|
61
61
|
<td style="padding: 10px;">
|
|
@@ -80,12 +80,7 @@ Requires-Dist: transformers~=4.0; extra == "transformers"
|
|
|
80
80
|
</td>
|
|
81
81
|
<td style="padding: 10px;">
|
|
82
82
|
<a href="https://discord.gg/gpumode">
|
|
83
|
-
<img src="https://dcbadge.
|
|
84
|
-
</a>
|
|
85
|
-
</td>
|
|
86
|
-
<td style="padding: 10px;">
|
|
87
|
-
<a href="https://gurubase.io/g/liger-kernel">
|
|
88
|
-
<img src="https://img.shields.io/badge/Gurubase-Ask%20Liger%20Kernel%20Guru-006BFF" alt="Ask Liger Kernel Guru">
|
|
83
|
+
<img src="https://dcbadge.limes.pink/api/server/gpumode?style=flat" alt="Join Our Discord">
|
|
89
84
|
</a>
|
|
90
85
|
</td>
|
|
91
86
|
</tr>
|
|
@@ -95,12 +90,16 @@ Requires-Dist: transformers~=4.0; extra == "transformers"
|
|
|
95
90
|
|
|
96
91
|
<img src="https://raw.githubusercontent.com/linkedin/Liger-Kernel/main/docs/images/logo-banner.png">
|
|
97
92
|
|
|
98
|
-
[Installation](#installation) | [Getting Started](#getting-started) | [Examples](#examples) | [APIs](#apis) | [Cite our work](#cite-this-work)
|
|
93
|
+
[Installation](#installation) | [Getting Started](#getting-started) | [Examples](#examples) | [High-level APIs](#high-level-apis) | [Low-level APIs](#low-level-apis) | [Cite our work](#cite-this-work)
|
|
99
94
|
|
|
100
95
|
<details>
|
|
101
96
|
<summary>Latest News 🔥</summary>
|
|
102
|
-
|
|
103
|
-
- [
|
|
97
|
+
|
|
98
|
+
- [2025/03/06] We release a joint blog post on TorchTune × Liger - [Peak Performance, Minimized Memory: Optimizing torchtune’s performance with torch.compile & Liger Kernel](https://pytorch.org/blog/peak-performance-minimized-memory/)
|
|
99
|
+
- [2024/12/11] We release [v0.5.0](https://github.com/linkedin/Liger-Kernel/releases/tag/v0.5.0): 80% more memory efficient post training losses (DPO, ORPO, CPO, etc)!
|
|
100
|
+
- [2024/12/5] We release LinkedIn Engineering Blog - [Liger-Kernel: Empowering an open source ecosystem of Triton Kernels for Efficient LLM Training](https://www.linkedin.com/blog/engineering/open-source/liger-kernel-open-source-ecosystem-for-efficient-llm-training)
|
|
101
|
+
- [2024/11/6] We release [v0.4.0](https://github.com/linkedin/Liger-Kernel/releases/tag/v0.4.0): Full AMD support, Tech Report, Modal CI, Llama-3.2-Vision!
|
|
102
|
+
- [2024/10/21] We have released the tech report of Liger Kernel on Arxiv: https://arxiv.org/pdf/2410.10989
|
|
104
103
|
- [2024/9/6] We release v0.2.1 ([X post](https://x.com/liger_kernel/status/1832168197002510649)). 2500+ Stars, 10+ New Contributors, 50+ PRs, 50k Downloads in two weeks!
|
|
105
104
|
- [2024/8/31] CUDA MODE talk, [Liger-Kernel: Real-world Triton kernel for LLM Training](https://youtu.be/gWble4FreV4?si=dxPeIchhkJ36Mbns), [Slides](https://github.com/cuda-mode/lectures?tab=readme-ov-file#lecture-28-liger-kernel)
|
|
106
105
|
- [2024/8/23] Official release: check out our [X post](https://x.com/hsu_byron/status/1827072737673982056)
|
|
@@ -110,6 +109,10 @@ Requires-Dist: transformers~=4.0; extra == "transformers"
|
|
|
110
109
|
|
|
111
110
|
**Liger Kernel** is a collection of Triton kernels designed specifically for LLM training. It can effectively increase multi-GPU **training throughput by 20%** and reduces **memory usage by 60%**. We have implemented **Hugging Face Compatible** `RMSNorm`, `RoPE`, `SwiGLU`, `CrossEntropy`, `FusedLinearCrossEntropy`, and more to come. The kernel works out of the box with [Flash Attention](https://github.com/Dao-AILab/flash-attention), [PyTorch FSDP](https://pytorch.org/tutorials/intermediate/FSDP_tutorial.html), and [Microsoft DeepSpeed](https://github.com/microsoft/DeepSpeed). We welcome contributions from the community to gather the best kernels for LLM training.
|
|
112
111
|
|
|
112
|
+
We've also added optimized Post-Training kernels that deliver **up to 80% memory savings** for alignment and distillation tasks. We support losses like DPO, CPO, ORPO, SimPO, KTO, JSD, and many more. Check out [how we optimize the memory](https://x.com/hsu_byron/status/1866577403918917655).
|
|
113
|
+
|
|
114
|
+
You can view the documentation site for additional installation, usage examples, and API references:https://linkedin.github.io/Liger-Kernel/
|
|
115
|
+
|
|
113
116
|
## Supercharge Your Model with Liger Kernel
|
|
114
117
|
|
|
115
118
|

|
|
@@ -125,20 +128,30 @@ With one line of code, Liger Kernel can increase throughput by more than 20% and
|
|
|
125
128
|
> - Benchmark conditions: LLaMA 3-8B, Batch Size = 8, Data Type = `bf16`, Optimizer = AdamW, Gradient Checkpointing = True, Distributed Strategy = FSDP1 on 8 A100s.
|
|
126
129
|
> - Hugging Face models start to OOM at a 4K context length, whereas Hugging Face + Liger Kernel scales up to 16K.
|
|
127
130
|
|
|
128
|
-
##
|
|
131
|
+
## Optimize Post Training with Liger Kernel
|
|
129
132
|
|
|
130
|
-
|
|
133
|
+
<p align="center">
|
|
134
|
+
<img src="https://raw.githubusercontent.com/linkedin/Liger-Kernel/main/docs/images/post-training.png" width="50%" alt="Post Training">
|
|
135
|
+
</p>
|
|
131
136
|
|
|
132
|
-
|
|
133
|
-
|------------------------------------------------|---------------------------------------------------------------------------------------------------|----------------------|
|
|
134
|
-
| [**Hugging Face Trainer**](https://github.com/linkedin/Liger-Kernel/tree/main/examples/huggingface) | Train LLaMA 3-8B ~20% faster with over 40% memory reduction on Alpaca dataset using 4 A100s with FSDP | TBA |
|
|
135
|
-
| [**Lightning Trainer**](https://github.com/linkedin/Liger-Kernel/tree/main/examples/lightning) | Increase 15% throughput and reduce memory usage by 40% with LLaMA3-8B on MMLU dataset using 8 A100s with DeepSpeed ZeRO3 | TBA |
|
|
137
|
+
We provide optimized post training kernels like DPO, ORPO, SimPO, and more which can reduce memory usage by up to 80%. You can easily use them as python modules.
|
|
136
138
|
|
|
137
|
-
|
|
139
|
+
```python
|
|
140
|
+
from liger_kernel.chunked_loss import LigerFusedLinearORPOLoss
|
|
141
|
+
orpo_loss = LigerFusedLinearORPOLoss()
|
|
142
|
+
y = orpo_loss(lm_head.weight, x, target)
|
|
143
|
+
```
|
|
138
144
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
145
|
+
|
|
146
|
+
## Examples
|
|
147
|
+
|
|
148
|
+
| **Use Case** | **Description** |
|
|
149
|
+
|------------------------------------------------|---------------------------------------------------------------------------------------------------|
|
|
150
|
+
| [**Hugging Face Trainer**](https://github.com/linkedin/Liger-Kernel/tree/main/examples/huggingface) | Train LLaMA 3-8B ~20% faster with over 40% memory reduction on Alpaca dataset using 4 A100s with FSDP |
|
|
151
|
+
| [**Lightning Trainer**](https://github.com/linkedin/Liger-Kernel/tree/main/examples/lightning) | Increase 15% throughput and reduce memory usage by 40% with LLaMA3-8B on MMLU dataset using 8 A100s with DeepSpeed ZeRO3 |
|
|
152
|
+
| [**Medusa Multi-head LLM (Retraining Phase)**](https://github.com/linkedin/Liger-Kernel/tree/main/examples/medusa) | Reduce memory usage by 80% with 5 LM heads and improve throughput by 40% using 8 A100s with FSDP |
|
|
153
|
+
| [**Vision-Language Model SFT**](https://github.com/linkedin/Liger-Kernel/tree/main/examples/huggingface/run_qwen2_vl.sh) | Finetune Qwen2-VL on image-text data using 4 A100s with FSDP |
|
|
154
|
+
| [**Liger ORPO Trainer**](https://github.com/linkedin/Liger-Kernel/blob/main/examples/alignment/run_orpo.py) | Align Llama 3.2 using Liger ORPO Trainer with FSDP with 50% memory reduction |
|
|
142
155
|
|
|
143
156
|
## Key Features
|
|
144
157
|
|
|
@@ -147,18 +160,11 @@ With one line of code, Liger Kernel can increase throughput by more than 20% and
|
|
|
147
160
|
- **Exact:** Computation is exact—no approximations! Both forward and backward passes are implemented with rigorous unit tests and undergo convergence testing against training runs without Liger Kernel to ensure accuracy.
|
|
148
161
|
- **Lightweight:** Liger Kernel has minimal dependencies, requiring only Torch and Triton—no extra libraries needed! Say goodbye to dependency headaches!
|
|
149
162
|
- **Multi-GPU supported:** Compatible with multi-GPU setups (PyTorch FSDP, DeepSpeed, DDP, etc.).
|
|
150
|
-
- **Trainer Framework Integration**: [Axolotl](https://github.com/axolotl-ai-cloud/axolotl), [LLaMa-Factory](https://github.com/hiyouga/LLaMA-Factory), [SFTTrainer](https://github.com/huggingface/trl/releases/tag/v0.10.1), [Hugging Face Trainer](https://github.com/huggingface/transformers/pull/32860), [SWIFT](https://github.com/modelscope/ms-swift)
|
|
151
|
-
|
|
152
|
-
## Target Audiences
|
|
153
|
-
|
|
154
|
-
- **Researchers**: Looking to compose models using efficient and reliable kernels for frontier experiments.
|
|
155
|
-
- **ML Practitioners**: Focused on maximizing GPU training efficiency with optimal, high-performance kernels.
|
|
156
|
-
- **Curious Novices**: Eager to learn how to write reliable Triton kernels to enhance training efficiency.
|
|
157
|
-
|
|
163
|
+
- **Trainer Framework Integration**: [Axolotl](https://github.com/axolotl-ai-cloud/axolotl), [LLaMa-Factory](https://github.com/hiyouga/LLaMA-Factory), [SFTTrainer](https://github.com/huggingface/trl/releases/tag/v0.10.1), [Hugging Face Trainer](https://github.com/huggingface/transformers/pull/32860), [SWIFT](https://github.com/modelscope/ms-swift), [oumi](https://github.com/oumi-ai/oumi/tree/main)
|
|
158
164
|
|
|
159
165
|
## Installation
|
|
160
166
|
|
|
161
|
-
### Dependencies
|
|
167
|
+
### Dependencies
|
|
162
168
|
|
|
163
169
|
#### CUDA
|
|
164
170
|
|
|
@@ -170,6 +176,11 @@ With one line of code, Liger Kernel can increase throughput by more than 20% and
|
|
|
170
176
|
- `torch >= 2.5.0` Install according to the instruction in Pytorch official webpage.
|
|
171
177
|
- `triton >= 3.0.0` Install from pypi. (e.g. `pip install triton==3.0.0`)
|
|
172
178
|
|
|
179
|
+
```bash
|
|
180
|
+
pip install -e .[dev]
|
|
181
|
+
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.3/
|
|
182
|
+
```
|
|
183
|
+
|
|
173
184
|
### Optional Dependencies
|
|
174
185
|
|
|
175
186
|
- `transformers >= 4.x`: Required if you plan to use the transformers models patching APIs. The specific model you are working will dictate the minimum version of transformers.
|
|
@@ -194,9 +205,16 @@ To install from source:
|
|
|
194
205
|
```bash
|
|
195
206
|
git clone https://github.com/linkedin/Liger-Kernel.git
|
|
196
207
|
cd Liger-Kernel
|
|
208
|
+
|
|
209
|
+
# Install Default Dependencies
|
|
210
|
+
# Setup.py will detect whether you are using AMD or NVIDIA
|
|
197
211
|
pip install -e .
|
|
198
|
-
|
|
199
|
-
|
|
212
|
+
|
|
213
|
+
# Setup Development Dependencies
|
|
214
|
+
pip install -e ".[dev]"
|
|
215
|
+
|
|
216
|
+
# NOTE -> For AMD users only
|
|
217
|
+
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.3/
|
|
200
218
|
```
|
|
201
219
|
|
|
202
220
|
|
|
@@ -242,7 +260,7 @@ model = transformers.AutoModelForCausalLM("path/to/llama/model")
|
|
|
242
260
|
|
|
243
261
|
### 3. Compose Your Own Model
|
|
244
262
|
|
|
245
|
-
You can take individual [kernels](#kernels) to compose your models.
|
|
263
|
+
You can take individual [kernels](https://github.com/linkedin/Liger-Kernel?tab=readme-ov-file#model-kernels) to compose your models.
|
|
246
264
|
|
|
247
265
|
```python
|
|
248
266
|
from liger_kernel.transformers import LigerFusedLinearCrossEntropyLoss
|
|
@@ -261,24 +279,7 @@ loss = loss_fn(model.weight, input, target)
|
|
|
261
279
|
loss.backward()
|
|
262
280
|
```
|
|
263
281
|
|
|
264
|
-
|
|
265
|
-
## Structure
|
|
266
|
-
|
|
267
|
-
### Source Code
|
|
268
|
-
|
|
269
|
-
- `ops/`: Core Triton operations.
|
|
270
|
-
- `transformers/`: PyTorch `nn.Module` implementations built on Triton operations, compliant with the `transformers` API.
|
|
271
|
-
|
|
272
|
-
### Tests
|
|
273
|
-
|
|
274
|
-
- `transformers/`: Correctness tests for the Triton-based layers.
|
|
275
|
-
- `convergence/`: Patches Hugging Face models with all kernels, runs multiple iterations, and compares weights, logits, and loss layer-by-layer.
|
|
276
|
-
|
|
277
|
-
### Benchmark
|
|
278
|
-
|
|
279
|
-
- `benchmark/`: Execution time and memory benchmarks compared to Hugging Face layers.
|
|
280
|
-
|
|
281
|
-
## APIs
|
|
282
|
+
## High-level APIs
|
|
282
283
|
|
|
283
284
|
### AutoModel
|
|
284
285
|
|
|
@@ -291,19 +292,34 @@ loss.backward()
|
|
|
291
292
|
|
|
292
293
|
| **Model** | **API** | **Supported Operations** |
|
|
293
294
|
|-------------|--------------------------------------------------------------|-------------------------------------------------------------------------|
|
|
295
|
+
| Llama4 (Text) & (Multimodal) | `liger_kernel.transformers.apply_liger_kernel_to_llama4` | RMSNorm, LayerNorm, GeGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
294
296
|
| LLaMA 2 & 3 | `liger_kernel.transformers.apply_liger_kernel_to_llama` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
295
297
|
| LLaMA 3.2-Vision | `liger_kernel.transformers.apply_liger_kernel_to_mllama` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
296
298
|
| Mistral | `liger_kernel.transformers.apply_liger_kernel_to_mistral` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
297
299
|
| Mixtral | `liger_kernel.transformers.apply_liger_kernel_to_mixtral` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
298
300
|
| Gemma1 | `liger_kernel.transformers.apply_liger_kernel_to_gemma` | RoPE, RMSNorm, GeGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
299
|
-
| Gemma2 | `liger_kernel.transformers.apply_liger_kernel_to_gemma2` | RoPE, RMSNorm, GeGLU, CrossEntropyLoss |
|
|
300
|
-
|
|
|
301
|
-
|
|
|
301
|
+
| Gemma2 | `liger_kernel.transformers.apply_liger_kernel_to_gemma2` | RoPE, RMSNorm, GeGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
302
|
+
| Gemma3 (Text) | `liger_kernel.transformers.apply_liger_kernel_to_gemma3_text` | RoPE, RMSNorm, GeGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
303
|
+
| Gemma3 (Multimodal) | `liger_kernel.transformers.apply_liger_kernel_to_gemma3` | LayerNorm, RoPE, RMSNorm, GeGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
304
|
+
| Paligemma, Paligemma2, & Paligemma2 Mix | `liger_kernel.transformers.apply_liger_kernel_to_paligemma` | LayerNorm, RoPE, RMSNorm, GeGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
305
|
+
| Qwen2, Qwen2.5, & QwQ | `liger_kernel.transformers.apply_liger_kernel_to_qwen2` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
306
|
+
| Qwen2-VL, & QVQ | `liger_kernel.transformers.apply_liger_kernel_to_qwen2_vl` | RMSNorm, LayerNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
307
|
+
| Qwen2.5-VL | `liger_kernel.transformers.apply_liger_kernel_to_qwen2_5_vl` | RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
308
|
+
| Qwen3 | `liger_kernel.transformers.apply_liger_kernel_to_qwen3` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
309
|
+
| Qwen3 MoE | `liger_kernel.transformers.apply_liger_kernel_to_qwen3_moe` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
302
310
|
| Phi3 & Phi3.5 | `liger_kernel.transformers.apply_liger_kernel_to_phi3` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
311
|
+
| Granite 3.0 & 3.1 | `liger_kernel.transformers.apply_liger_kernel_to_granite` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss |
|
|
312
|
+
| OLMo2 | `liger_kernel.transformers.apply_liger_kernel_to_olmo2` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
313
|
+
| GLM-4 | `liger_kernel.transformers.apply_liger_kernel_to_glm4` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
314
|
+
| InternVL3 | `liger_kernel.transformers.apply_liger_kernel_to_internvl` | RoPE, RMSNorm, SwiGLU, CrossEntropyLoss, FusedLinearCrossEntropy |
|
|
303
315
|
|
|
304
316
|
|
|
317
|
+
## Low-level APIs
|
|
305
318
|
|
|
306
|
-
|
|
319
|
+
- `Fused Linear` kernels combine linear layers with losses, reducing memory usage by up to 80% - ideal for HBM-constrained workloads.
|
|
320
|
+
- Other kernels use fusion and in-place techniques for memory and performance optimization.
|
|
321
|
+
|
|
322
|
+
### Model Kernels
|
|
307
323
|
|
|
308
324
|
| **Kernel** | **API** |
|
|
309
325
|
|---------------------------------|-------------------------------------------------------------|
|
|
@@ -313,112 +329,109 @@ loss.backward()
|
|
|
313
329
|
| SwiGLU | `liger_kernel.transformers.LigerSwiGLUMLP` |
|
|
314
330
|
| GeGLU | `liger_kernel.transformers.LigerGEGLUMLP` |
|
|
315
331
|
| CrossEntropy | `liger_kernel.transformers.LigerCrossEntropyLoss` |
|
|
316
|
-
|
|
|
317
|
-
|
|
|
318
|
-
|
|
|
319
|
-
|
|
|
320
|
-
|
|
321
|
-
- **RMSNorm**: [RMSNorm](https://arxiv.org/pdf/1910.07467), which normalizes activations using their root mean square, is implemented by fusing the normalization and scaling steps into a single Triton kernel, and achieves ~3X speedup with ~3X peak memory reduction.
|
|
322
|
-
- **LayerNorm**: [LayerNorm](https://arxiv.org/pdf/1607.06450), which centers and normalizes activations across the feature dimension, is implemented by fusing the centering, normalization and scaling steps into a single Triton kernel, and achieves ~2X speedup.
|
|
323
|
-
- **RoPE**: [Rotary Positional Embedding](https://arxiv.org/pdf/2104.09864) is implemented by fusing the query and key embedding rotary into a single kernel with inplace replacement, and achieves ~3X speedup with ~3X peak memory reduction.
|
|
324
|
-
- **SwiGLU**: [Swish Gated Linear Units](https://arxiv.org/pdf/2002.05202), given by
|
|
325
|
-
$$\text{SwiGLU}(x)=\text{Swish}_{\beta}(xW+b)\otimes(xV+c)$$
|
|
326
|
-
, is implemented by fusing the elementwise multiplication (denoted by $\otimes$) into a single kernel with inplace replacement, and achieves parity speed with ~1.5X peak memory reduction.
|
|
327
|
-
- **GeGLU**: [GELU Gated Linear Units](https://arxiv.org/pdf/2002.05202), given by
|
|
328
|
-
$$\text{GeGLU}(x)=\text{GELU}(xW+b)\otimes(xV+c)$$
|
|
329
|
-
, is implemented by fusing the elementwise multiplication into a single kernel with inplace replacement, and achieves parity speed with ~1.5X peak memory reduction. Note that the [tanh approximation form of GELU](https://pytorch.org/docs/stable/generated/torch.nn.GELU.html) is used.
|
|
330
|
-
- **CrossEntropy**: [Cross entropy loss](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html) is implemented by computing both the loss and gradient in the forward pass with inplace replacement of input to reduce the peak memory by avoiding simultaneous materialization of both input logits and gradient. It achieves >2X speedup and >4X memory reduction for common vocab sizes (e.g., 32K, 128K, etc.).
|
|
331
|
-
<!-- TODO: verify vocab sizes are accurate -->
|
|
332
|
-
- **FusedLinearCrossEntropy**: Peak memory usage of cross entropy loss is further improved by fusing the model head with the CE loss and chunking the input for block-wise loss and gradient calculation, a technique inspired by [Efficient Cross Entropy](https://github.com/mgmalek/efficient_cross_entropy). It achieves >4X memory reduction for 128k vocab size. **This is highly effective for large batch size, large sequence length, and large vocabulary sizes.** Please refer to the [Medusa example](https://github.com/linkedin/Liger-Kernel/tree/main/examples/medusa) for individual kernel usage.
|
|
333
|
-
- **KLDivergence**: [KL Divergence](https://pytorch.org/docs/stable/generated/torch.nn.KLDivLoss.html) is implemented by fusing the forward into a single triton kernel, with reduction done outside the kernel. It achieves ~1.5X speed and ~15% memory reduction for 128K vocab size.
|
|
334
|
-
- **JSD**: [Generalized JSD](https://arxiv.org/pdf/2306.13649) (Jensen-Shannon divergence), is implemented by computing both the loss and gradient in the forward pass. It achieves ~1.5X speed and ~54% memory reduction for 128k vocab size.
|
|
335
|
-
- **FusedLinearJSD**: Peak memory usage of JSD loss is further improved by fusing the model head with the model head with the JSD and chunking the input for block-wise loss and gradient calculation. It achieves ~85% memory reduction for 128k vocab size where batch size $\times$ sequence length is 8192.
|
|
332
|
+
| Fused Linear CrossEntropy | `liger_kernel.transformers.LigerFusedLinearCrossEntropyLoss`|
|
|
333
|
+
| Multi Token Attention | `liger_kernel.transformers.LigerMultiTokenAttention` |
|
|
334
|
+
| Softmax | `liger_kernel.transformers.LigerSoftmax` |
|
|
335
|
+
| Sparsemax | `liger_kernel.transformers.LigerSparsemax` |
|
|
336
336
|
|
|
337
337
|
|
|
338
|
-
###
|
|
338
|
+
### Alignment Kernels
|
|
339
339
|
|
|
340
340
|
| **Kernel** | **API** |
|
|
341
341
|
|---------------------------------|-------------------------------------------------------------|
|
|
342
|
-
|
|
|
343
|
-
|
|
|
342
|
+
| Fused Linear CPO Loss | `liger_kernel.chunked_loss.LigerFusedLinearCPOLoss` |
|
|
343
|
+
| Fused Linear DPO Loss | `liger_kernel.chunked_loss.LigerFusedLinearDPOLoss` |
|
|
344
|
+
| Fused Linear ORPO Loss | `liger_kernel.chunked_loss.LigerFusedLinearORPOLoss` |
|
|
345
|
+
| Fused Linear SimPO Loss | `liger_kernel.chunked_loss.LigerFusedLinearSimPOLoss` |
|
|
346
|
+
| Fused Linear KTO Loss | `liger_kernel.chunked_loss.LigerFusedLinearKTOLoss` |
|
|
344
347
|
|
|
345
|
-
|
|
346
|
-
- **Matmul int2xint8**: is implemented by using the cache tiled matrix multiplication and by fusing the matmul with the unpacking process which achieves a considerable speed up and performs on par with @torch.compile
|
|
347
|
-
<!-- TODO: be more specific about batch size -->
|
|
348
|
-
> **Note:**
|
|
349
|
-
> Reported speedups and memory reductions are with respect to the LLaMA 3-8B Hugging Face layer implementations. All models use 4K hidden size and 4K sequence length and are evaluated based on memory usage and wall time for the forward+backward pass on a single NVIDIA A100 80G GPU using small batch sizes. Liger kernels exhibit more efficient scaling to larger batch sizes, detailed further in the [Benchmark](./benchmark) folder.
|
|
350
|
-
|
|
351
|
-
## Contributing
|
|
348
|
+
### Distillation Kernels
|
|
352
349
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
350
|
+
| **Kernel** | **API** |
|
|
351
|
+
|---------------------------------|-------------------------------------------------------------|
|
|
352
|
+
| KLDivergence | `liger_kernel.transformers.LigerKLDIVLoss` |
|
|
353
|
+
| JSD | `liger_kernel.transformers.LigerJSD` |
|
|
354
|
+
| Fused Linear JSD | `liger_kernel.transformers.LigerFusedLinearJSD` |
|
|
355
|
+
| TVD | `liger_kernel.transformers.LigerTVDLoss` |
|
|
356
356
|
|
|
357
|
+
### Experimental Kernels
|
|
357
358
|
|
|
358
|
-
|
|
359
|
+
| **Kernel** | **API** |
|
|
360
|
+
|---------------------------------|-------------------------------------------------------------|
|
|
361
|
+
| Embedding | `liger_kernel.transformers.experimental.LigerEmbedding` |
|
|
362
|
+
| Matmul int2xint8 | `liger_kernel.transformers.experimental.matmul` |
|
|
359
363
|
|
|
360
|
-
- [@claire_yishan](https://twitter.com/claire_yishan) for the LOGO design
|
|
361
|
-
- [Wave Snippets](https://www.wavesnippets.com/) for generating the animated code snippets
|
|
362
364
|
|
|
363
|
-
|
|
365
|
+
## Contributing, Acknowledgements, and License
|
|
364
366
|
|
|
365
|
-
|
|
367
|
+
- [Contributing Guidelines](https://github.com/linkedin/Liger-Kernel/blob/main/docs/contributing.md)
|
|
368
|
+
- [Acknowledgements](https://github.com/linkedin/Liger-Kernel/blob/main/docs/acknowledgement.md)
|
|
369
|
+
- [License Information](https://github.com/linkedin/Liger-Kernel/blob/main/docs/license.md)
|
|
366
370
|
|
|
371
|
+
## Sponsorship and Collaboration
|
|
367
372
|
|
|
373
|
+
- [Glows.ai](https://platform.glows.ai/): Sponsoring NVIDIA GPUs for our open source developers.
|
|
374
|
+
- [AMD](https://www.amd.com/en.html): Providing AMD GPUs for our AMD CI.
|
|
375
|
+
- [Intel](https://www.intel.com/): Providing Intel GPUs for our Intel CI.
|
|
376
|
+
- [Modal](https://modal.com/): Free 3000 credits from GPU MODE IRL for our NVIDIA CI.
|
|
377
|
+
- [EmbeddedLLM](https://embeddedllm.com/): Making Liger Kernel run fast and stable on AMD.
|
|
378
|
+
- [HuggingFace](https://huggingface.co/): Integrating Liger Kernel into Hugging Face Transformers and TRL.
|
|
379
|
+
- [Lightning AI](https://lightning.ai/): Integrating Liger Kernel into Lightning Thunder.
|
|
380
|
+
- [Axolotl](https://axolotl.ai/): Integrating Liger Kernel into Axolotl.
|
|
381
|
+
- [Llama-Factory](https://github.com/hiyouga/LLaMA-Factory): Integrating Liger Kernel into Llama-Factory.
|
|
368
382
|
|
|
369
|
-
| # | Project | Description | Location | License |
|
|
370
|
-
|---|----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
|
|
371
|
-
| 1 | [Unsloth](https://github.com/unslothai/unsloth/blob/fd753fed99ed5f10ef8a9b7139588d9de9ddecfb/unsloth/kernels/utils.py#L43) | `calculate_settings` to determine block size and warp; We reuse it for Norm and MLP | [Liger Kernel Utils](https://github.com/linkedin/Liger-Kernel/blob/e249eee723978bf8610ff1ea2297d048a2417e20/src/liger_kernel/ops/utils.py#L23) | [Apache](https://github.com/unslothai/unsloth/blob/fd753fed99ed5f10ef8a9b7139588d9de9ddecfb/LICENSE) |
|
|
372
|
-
| 2 | [Unsloth](https://github.com/unslothai/unsloth/blob/976d11a10d54383aeb7a692c69e01151a20bfd72/unsloth/kernels/rms_layernorm.py#L48) | We modified and added dW calculation on top of Unsloth implementation | [Liger Kernel RMS Norm](https://github.com/linkedin/Liger-Kernel/blob/e249eee723978bf8610ff1ea2297d048a2417e20/src/liger_kernel/ops/rms_norm.py#L50) | [Apache](https://github.com/unslothai/unsloth/blob/fd753fed99ed5f10ef8a9b7139588d9de9ddecfb/LICENSE) |
|
|
373
|
-
| 3 | [Triton tutorial](https://triton-lang.org/main/index.html) | We modified on top of triton tutorials | [Liger Kernel RMS Norm](https://github.com/linkedin/Liger-Kernel/blob/e249eee723978bf8610ff1ea2297d048a2417e20/src/liger_kernel/ops/rms_norm.py#L50) | [MIT](https://github.com/triton-lang/triton/blob/main/LICENSE) |
|
|
374
|
-
| 4 | [tiny shakespeare dataset](https://huggingface.co/datasets/karpathy/tiny_shakespeare) | We use tiny shakespeare dataset to conduct convergence test on mini model | [Liger Kernel Convergence](https://github.com/linkedin/Liger-Kernel/tree/main/test/convergence) | N/A |
|
|
375
|
-
| 5 | [Efficient Cross Entropy](https://github.com/mgmalek/efficient_cross_entropy) | We use the idea of gradient-in-forward and chunking | [Liger Kernel Linear Cross Entropy](https://github.com/linkedin/Liger-Kernel/blob/main/src/liger_kernel/ops/fused_linear_cross_entropy.py) | [MIT](https://github.com/mgmalek/efficient_cross_entropy/blob/main/LICENSE) |
|
|
376
|
-
| 6 | [Flash attn](https://github.com/Dao-AILab/flash-attention) | We take many optimization ideas from the work, such as tiling and recomputation | | [BSD](https://github.com/Dao-AILab/flash-attention/blob/main/LICENSE) |
|
|
377
|
-
| 7 | [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) | We reference the design of automodel | [Liger Kernel Auto Model](https://github.com/linkedin/Liger-Kernel/blob/main/src/liger_kernel/transformers/auto_model.py) | [MIT](https://github.com/casper-hansen/AutoAWQ/blob/main/LICENSE) |
|
|
378
|
-
| 8 | [llm.c](https://github.com/karpathy/llm.c) | We reference the design of end-to-end testing | [Liger Kernel Convergence Tests](https://github.com/linkedin/Liger-Kernel/tree/main/test/convergence) | [MIT](https://github.com/karpathy/llm.c/blob/master/LICENSE) |
|
|
379
383
|
|
|
380
|
-
|
|
384
|
+
## CI status
|
|
381
385
|
|
|
382
|
-
|
|
386
|
+
<table style="width: 100%; text-align: center; border-collapse: collapse;">
|
|
387
|
+
<tr>
|
|
388
|
+
<th style="padding: 10px;">Build</th>
|
|
389
|
+
</tr>
|
|
390
|
+
<tr>
|
|
391
|
+
<td style="padding: 10px;">
|
|
392
|
+
<div style="display: block;">
|
|
393
|
+
<a href="https://github.com/linkedin/Liger-Kernel/actions/workflows/nvi-ci.yml">
|
|
394
|
+
<img src="https://github.com/linkedin/Liger-Kernel/actions/workflows/nvi-ci.yml/badge.svg?branch=main&event=push" alt="Build">
|
|
395
|
+
</a>
|
|
396
|
+
</div>
|
|
397
|
+
<div style="display: block;">
|
|
398
|
+
<a href="https://github.com/linkedin/Liger-Kernel/actions/workflows/amd-ci.yml">
|
|
399
|
+
<img src="https://github.com/linkedin/Liger-Kernel/actions/workflows/amd-ci.yml/badge.svg?branch=main&event=push" alt="Build">
|
|
400
|
+
</a>
|
|
401
|
+
</div>
|
|
402
|
+
<div style="display: block;">
|
|
403
|
+
<a href="https://github.com/linkedin/Liger-Kernel/actions/workflows/intel-ci.yml">
|
|
404
|
+
<img src="https://github.com/linkedin/Liger-Kernel/actions/workflows/intel-ci.yml/badge.svg?branch=main&event=push" alt="Build">
|
|
405
|
+
</a>
|
|
406
|
+
</div>
|
|
407
|
+
</td>
|
|
408
|
+
</tr>
|
|
409
|
+
</table>
|
|
383
410
|
|
|
384
|
-
This project is licensed under the [BSD 2-CLAUSE](https://github.com/linkedin/Liger-Kernel/blob/main/LICENSE) License (see `LICENSE` for details).
|
|
385
|
-
It also includes components from projects licensed under:
|
|
386
411
|
|
|
387
|
-
- Apache License 2.0 (see `LICENSE-APACHE-2.0` for details).
|
|
388
|
-
- MIT License (see `LICENSE-MIT-AutoAWQ` for details).
|
|
389
|
-
- MIT License (see `LICENSE-MIT-Efficient Cross Entropy` for details).
|
|
390
|
-
- MIT License (see `LICENSE-MIT-llmc` for details).
|
|
391
|
-
- MIT License (see `LICENSE-MIT-triton` for details).
|
|
392
412
|
|
|
393
413
|
## Contact
|
|
394
414
|
|
|
395
|
-
- For
|
|
396
|
-
- For
|
|
415
|
+
- For issues, create a Github ticket in this repository
|
|
416
|
+
- For open discussion, join [our discord channel on GPUMode](https://discord.com/channels/1189498204333543425/1275130785933951039)
|
|
417
|
+
- For formal collaboration, send an email to Yanning Chen(yannchen@linkedin.com) and Zhipeng Wang(zhipwang@linkedin.com)
|
|
397
418
|
|
|
398
419
|
## Cite this work
|
|
399
420
|
|
|
400
421
|
Biblatex entry:
|
|
401
422
|
```bib
|
|
402
|
-
@
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
url={https://arxiv.org/abs/2410.10989},
|
|
410
|
-
journal={arXiv preprint arXiv:2410.10989},
|
|
423
|
+
@inproceedings{
|
|
424
|
+
hsu2025ligerkernel,
|
|
425
|
+
title={Liger-Kernel: Efficient Triton Kernels for {LLM} Training},
|
|
426
|
+
author={Pin-Lun Hsu and Yun Dai and Vignesh Kothapalli and Qingquan Song and Shao Tang and Siyu Zhu and Steven Shimizu and Shivam Sahni and Haowen Ning and Yanning Chen and Zhipeng Wang},
|
|
427
|
+
booktitle={Championing Open-source DEvelopment in ML Workshop @ ICML25},
|
|
428
|
+
year={2025},
|
|
429
|
+
url={https://openreview.net/forum?id=36SjAIT42G}
|
|
411
430
|
}
|
|
412
431
|
```
|
|
413
432
|
|
|
414
433
|
## Star History
|
|
415
|
-
[](https://star-history.com/#linkedin/Liger-Kernel&Date)
|
|
416
|
-
|
|
417
|
-
## Contributors
|
|
418
|
-
|
|
419
|
-
<a href="https://github.com/linkedin/Liger-Kernel/graphs/contributors">
|
|
420
|
-
<img alt="contributors" src="https://contrib.rocks/image?repo=linkedin/Liger-Kernel"/>
|
|
421
|
-
</a>
|
|
434
|
+
[](https://www.star-history.com/#linkedin/Liger-Kernel&Date)
|
|
422
435
|
|
|
423
436
|
<p align="right" style="font-size: 14px; color: #555; margin-top: 20px;">
|
|
424
437
|
<a href="#readme-top" style="text-decoration: none; color: #007bff; font-weight: bold;">
|