linkedin / linkedin/Liger-Kernel

Check if cross entropy is applied correctly in all monkey patch functions

Open
#920 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.6k
Forks
603
Avg merge
1d 20h
Merged PRs (30d)
47

Description

🐛 Describe the bug

Some of them aren't patched to the correct object.
For example: InternVL doesn't have nn.CrossEntropy in its modeling file. The monkey patch should be applied to the loss_util file (See comment)
https://github.com/linkedin/Liger-Kernel/blob/da6e7059fd3b496f3bae6152e5814e72a495601a/src/liger_kernel/transformers/monkey_patch.py#L2070-L2072

Note that some monkey patch functions are outdated, so you may need to check them manually

p.s. we only need to support transformers>=4.49.0. bwd-test ci is targeting to 4.49.0.

Reproduce

No response

Versions

liger_kernel==https://github.com/linkedin/Liger-Kernel/commit/da6e7059fd3b496f3bae6152e5814e72a495601a

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/liger_kernel/transformers/monkey_patch.py around lines 2070-2072 and review the related monkey-patch functions manually. Compare each cross-entropy target with the corresponding Transformers 4.49.0 model or loss_util location, using the linked PR comment as context. Run the bwd-test CI coverage to confirm that all supported patches target the correct objects.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.