mirror of
https://github.com/linkedin/Liger-Kernel.git
synced 2026-10-12 02:17:47 +00:00
## Summary Fixes a bug in `LigerFusedLinearCrossEntropyFunction.forward` where `ctx.save_for_backward` checks `bias is not None` instead of `grad_bias is not None` before calling `.detach()`. When `input_requires_grad=False`, `fused_linear_cross_entropy_forward` sets `grad_bias = None` regardless of whether `bias` is provided. The stale check then calls `None.detach()` and raises `AttributeError`. Fixes #1156 ## Details One-line fix in `src/liger_kernel/ops/fused_linear_cross_entropy.py`: Before: `grad_bias.detach() if bias is not None else None,` After: `grad_bias.detach() if grad_bias is not None else None,` ## Testing Done - Hardware Type: CPU (logic-only fix, no GPU kernel change) - [x] run `make test` to ensure correctness - [x] run `make checkstyle` to ensure code style - [ ] run `make test-convergence` to ensure convergence