-
Notifications
You must be signed in to change notification settings - Fork 324
GKD trainer + chunked JSD loss + FSDP #615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The approach is similar to LigerORPOTrainer where we pass the models' lm_head weights and last hidden states to Liger{ORPO/JSD}Loss which should then return the expected loss. Liger-Kernel/src/liger_kernel/transformers/trainer/orpo_trainer.py Lines 18 to 66 in 2bb8dcf
Took a quick look through the GKDTrainer in trl -- I'd say you need to patch the
Don't have the exact code snippet but can point you to two references:
|
Hello Liger Kernel team,
First of all, thank you for making this project available! I’ve been exploring your codebase and tried to implement GKDTrainer using the chunked_jsd_loss similarly to how ORPOTrainer handles it. I’m now aiming to use Fully Sharded Data Parallel (FSDP) for both the teacher and student models but am unsure of the best way to integrate it.
I would greatly appreciate any guidance you could provide on:
Implementing the chunked JSD loss function for FSDP-enabled training – Are there recommended patterns or helper functions within the codebase that can simplify this process?
Key code structures or APIs in the GKDTrainer – Which parts of GKDTrainer might need modification or extension to properly handle chunked JSD loss under FSDP?
Best practices or potential pitfalls – Have you encountered any common issues or gotchas when combining chunked losses with FSDP that I should be aware of?
Code snippets or references – If you have any example snippets, documentation references, or design patterns that illustrate how to properly handle teacher and student models together under FSDP, that would be incredibly helpful.
Thank you in advance for your time and assistance! Any insights, tips, or examples you can share will help me get up and running much more quickly.
Additional Context:
I’m currently referencing the ORPOTrainer sample but see that it doesn’t fully address the GKD use case.
The text was updated successfully, but these errors were encountered: