- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.3k
[SFT] Log mean token accuracy from Liger kernel #4302
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
base: main
Are you sure you want to change the base?
Conversation
| The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. | 
| # Compute token accuracy if we have labels and if the model is not using Liger (no logits) | ||
| if not self.args.use_liger_kernel: | ||
| if self.args.use_liger_kernel: | ||
| if hasattr(outputs, "token_accuracy") and outputs.token_accuracy is not None: | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer using an explicit condition, like this:
if self.args.use_liger_kernel and version("liger_kernel") >= "0.6.4":
    token_accuracy = self.accelerator.gather_for_metrics(outputs.token_accuracy).mean().item()
    self._metrics[mode]["mean_token_accuracy"].append(token_accuracy)Having the explicit condition makes it much easier to spot when the check can be removed after we bump the minimum liger_kernel version. It’s clearer and more maintainable than hiding the logic elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the question is then, which version will include this feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue with this is that I cannot test it since the dev version is the current version in their setup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah true
What does this PR do?
We log the mean token accuracy from Liger kernel if it is available
Requires linkedin/Liger-Kernel#910
to test do:
Before submitting
Pull Request section?
to it if that's the case.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.