Files
Liger-Kernel/test
Tcc0403 4d07b58dd1 fix(flce): add shift_labels as eval mode loss condition (#888)
## Summary
<!--- This is a required section; please describe the main purpose of
this proposed code change. --->
Fix https://github.com/snowflakedb/ArcticTraining/issues/266
<!---
## Details
This is an optional section; is there anything specific that reviewers
should be aware of?
--->
In liger flce patch, there are two branches in model.forward

1. If the model is in training mode, liger calls fused linear cross
entropy to skip logit materialization and only calculates loss.
2. If the model is in eval mode, liger actually calls the original
forward method,
CrossEntropy(self.lm_head(hidden_states, labels), to track full logits
and loss.

However, liger doesn't check the `shift_labels` in the [eval
branch](https://github.com/linkedin/Liger-Kernel/blob/d1441a0de8ee93bb3d316ba10ed449e89607825a/src/liger_kernel/transformers/model/llama.py#L249-L257),
leaving loss=None without performing the loss calculation when we only
passes `shift_labels` in eval mode.

## 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
- [x] run `make checkstyle` to ensure code style
- [ ] run `make test-convergence` to ensure convergence

---------

Signed-off-by: Tcc0403 <[email protected]>
2025-10-08 16:40:58 +08:00
..
2025-09-03 09:44:13 -07:00
2025-10-05 16:35:28 -07:00
2025-10-05 16:35:28 -07:00
2025-10-05 16:35:28 -07:00
2024-08-06 18:44:05 +00:00
2024-10-25 17:23:23 -07:00