mirror of
https://github.com/linkedin/Liger-Kernel.git
synced 2026-10-12 02:17:47 +00:00
## 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]>