liger-kernel-nightly 0.5.5.dev20250327235657__py3-none-any.whl → 0.5.5.dev20250328142748__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/chunked_loss/fused_linear_distillation.py +15 -0
- liger_kernel/ops/kl_div.py +2 -2
- {liger_kernel_nightly-0.5.5.dev20250327235657.dist-info → liger_kernel_nightly-0.5.5.dev20250328142748.dist-info}/METADATA +1 -1
- {liger_kernel_nightly-0.5.5.dev20250327235657.dist-info → liger_kernel_nightly-0.5.5.dev20250328142748.dist-info}/RECORD +8 -8
- {liger_kernel_nightly-0.5.5.dev20250327235657.dist-info → liger_kernel_nightly-0.5.5.dev20250328142748.dist-info}/LICENSE +0 -0
- {liger_kernel_nightly-0.5.5.dev20250327235657.dist-info → liger_kernel_nightly-0.5.5.dev20250328142748.dist-info}/NOTICE +0 -0
- {liger_kernel_nightly-0.5.5.dev20250327235657.dist-info → liger_kernel_nightly-0.5.5.dev20250328142748.dist-info}/WHEEL +0 -0
- {liger_kernel_nightly-0.5.5.dev20250327235657.dist-info → liger_kernel_nightly-0.5.5.dev20250328142748.dist-info}/top_level.txt +0 -0
|
@@ -115,6 +115,21 @@ class LigerFusedLinearDistillationBase(torch.autograd.Function):
|
|
|
115
115
|
student_logits_chunk /= temperature
|
|
116
116
|
teacher_logits_chunk /= temperature
|
|
117
117
|
|
|
118
|
+
# If the teacher and student token size is different, pad student logits to match the teacher's.
|
|
119
|
+
# This only applies to cases where they share exactly the same vocab and tokenizer just
|
|
120
|
+
# that teacher logit is padded for some training efficiency such as
|
|
121
|
+
# https://huggingface.co/Qwen/Qwen1.5-72B-Chat/discussions/1#662883f568adf59b07b176d2
|
|
122
|
+
teacher_vocab_size = teacher_weight.shape[0]
|
|
123
|
+
student_vocab_size = student_weight.shape[0]
|
|
124
|
+
if teacher_vocab_size > student_vocab_size:
|
|
125
|
+
pad_size = teacher_vocab_size - student_vocab_size
|
|
126
|
+
pad_tensor = torch.zeros(
|
|
127
|
+
(*student_logits_chunk.shape[:-1], pad_size),
|
|
128
|
+
dtype=student_logits_chunk.dtype,
|
|
129
|
+
device=student_logits_chunk.device,
|
|
130
|
+
)
|
|
131
|
+
student_logits_chunk = torch.cat([student_logits_chunk, pad_tensor], dim=-1)
|
|
132
|
+
|
|
118
133
|
hard_loss /= full_target.shape[0]
|
|
119
134
|
|
|
120
135
|
soft_loss = distillation_loss_fn(student_logits_chunk, teacher_logits_chunk, **loss_kwargs)
|
liger_kernel/ops/kl_div.py
CHANGED
|
@@ -185,9 +185,9 @@ class LigerKLDivLossFunction(torch.autograd.Function):
|
|
|
185
185
|
Class implementing the forward and backward pass for the KL Divergence Loss using Triton, as defined by the following formula:
|
|
186
186
|
```python
|
|
187
187
|
if log_target:
|
|
188
|
-
loss = target * (target.log() - input)
|
|
189
|
-
else:
|
|
190
188
|
loss = target.exp() * (target - input)
|
|
189
|
+
else:
|
|
190
|
+
loss = target * (target.log() - input)
|
|
191
191
|
```,
|
|
192
192
|
then the loss is reduced according to the `reduction` parameter.
|
|
193
193
|
as defined in the PyTorch documentation: https://pytorch.org/docs/stable/generated/torch.nn.KLDivLoss.html
|
|
@@ -6,7 +6,7 @@ liger_kernel/chunked_loss/__init__.py,sha256=ATu-xX5Fc49Cr6yBOGBRNTo593ZrU5ZCsIu
|
|
|
6
6
|
liger_kernel/chunked_loss/cpo_loss.py,sha256=Gzz1eU4kgcbdubFVRy55e8A1Cr-r45UgNicXwZIjmBU,5454
|
|
7
7
|
liger_kernel/chunked_loss/dpo_loss.py,sha256=xZwGqS04si9zXyob95SAdalC-hajZg8fWINqiqffN8k,5855
|
|
8
8
|
liger_kernel/chunked_loss/functional.py,sha256=THWWpCnRVhTVfnPnyvQjdBvo1JDtxhwLmtZE_yiBBqM,817
|
|
9
|
-
liger_kernel/chunked_loss/fused_linear_distillation.py,sha256=
|
|
9
|
+
liger_kernel/chunked_loss/fused_linear_distillation.py,sha256=ooR-qnZCyWJN935oHCSWLaKKKyaYERyhNczRGi1VOiw,11935
|
|
10
10
|
liger_kernel/chunked_loss/fused_linear_preference.py,sha256=ojB42jYPu0c4ki96Ft-hy7Sf6fh_WikG-aWNrlZzSio,18362
|
|
11
11
|
liger_kernel/chunked_loss/fused_linear_rlhf.py,sha256=wGujqwLz91mOE9MmdenhBIKvbmswhwtINMCpcP7D74c,9050
|
|
12
12
|
liger_kernel/chunked_loss/fused_linear_unpaired_preference.py,sha256=RiuK3UtRwH9T6jZ36sA8Urj-TVuOLOO2syLg_JOQapY,13437
|
|
@@ -23,7 +23,7 @@ liger_kernel/ops/fused_linear_jsd.py,sha256=Seshez2qaM6HiTQ8_HEqSwhaeVruNT1SvIM4
|
|
|
23
23
|
liger_kernel/ops/geglu.py,sha256=axGvCIvlBzuluoAIrWTsp2iZM4BFKNInkPov8YVvH9E,4126
|
|
24
24
|
liger_kernel/ops/group_norm.py,sha256=qD4D4lSjSgVtO52EBNLC2iTseALRgPgqXE50U2woggk,10837
|
|
25
25
|
liger_kernel/ops/jsd.py,sha256=rkloGA7nDfVaa5nKY6-EYBw0E1p_MSsl4fr2xZGTp04,6961
|
|
26
|
-
liger_kernel/ops/kl_div.py,sha256=
|
|
26
|
+
liger_kernel/ops/kl_div.py,sha256=NkG7D6_DnPBzr-ohhYiQbRBnq_fbGmpn5UU7y0UBKQo,8420
|
|
27
27
|
liger_kernel/ops/layer_norm.py,sha256=6roQjioyg-9O2qLPV8nL4U0-5UH80tdzOMTWwjvDnn8,7961
|
|
28
28
|
liger_kernel/ops/qwen2vl_mrope.py,sha256=3GExhYpLgB4VUtyZyjRk8XjEur3W4EWF6HQ67ML5vBU,8481
|
|
29
29
|
liger_kernel/ops/rms_norm.py,sha256=PWLJcdIKU5e-8BuYFHd9Cqlq6wmr6fUXKi9zQD4LetU,11727
|
|
@@ -71,9 +71,9 @@ liger_kernel/transformers/trainer/__init__.py,sha256=p7yQfklV8-467qSz_ZMimkbDF7H
|
|
|
71
71
|
liger_kernel/transformers/trainer/orpo_trainer.py,sha256=pdekW7l6Qg_aqa5SYKYlSWUF8m3lkOFvFLcIMEHrz9s,8338
|
|
72
72
|
liger_kernel/triton/__init__.py,sha256=qCiCamzCRv6lpV8IqpAc9YMdNKC7GKurClWceQPnlis,92
|
|
73
73
|
liger_kernel/triton/monkey_patch.py,sha256=Rd0hUHAzDkFfHvnX7-PBaNK5EKnZhtfM_h-fgQH9HPY,1568
|
|
74
|
-
liger_kernel_nightly-0.5.5.
|
|
75
|
-
liger_kernel_nightly-0.5.5.
|
|
76
|
-
liger_kernel_nightly-0.5.5.
|
|
77
|
-
liger_kernel_nightly-0.5.5.
|
|
78
|
-
liger_kernel_nightly-0.5.5.
|
|
79
|
-
liger_kernel_nightly-0.5.5.
|
|
74
|
+
liger_kernel_nightly-0.5.5.dev20250328142748.dist-info/LICENSE,sha256=OhzLDHJ0to4a8sodVLELZiCFylZ1NAAYLs-HrjPy0ag,1312
|
|
75
|
+
liger_kernel_nightly-0.5.5.dev20250328142748.dist-info/METADATA,sha256=Pc3Vto00gFwlhnH6bI2JKBFQlcZ_ANrsADp_7z_TyzI,22959
|
|
76
|
+
liger_kernel_nightly-0.5.5.dev20250328142748.dist-info/NOTICE,sha256=njwnoPZLh9AN8SJQzxvCGLHi-8X__AvWRze6joNXIY8,2066
|
|
77
|
+
liger_kernel_nightly-0.5.5.dev20250328142748.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
78
|
+
liger_kernel_nightly-0.5.5.dev20250328142748.dist-info/top_level.txt,sha256=2eghu4hA3LnkM7ElW92tQ8zegWKgSbeo-k-aGe1YnvY,13
|
|
79
|
+
liger_kernel_nightly-0.5.5.dev20250328142748.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|