-
Notifications
You must be signed in to change notification settings - Fork 41
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
Enforce passing item_loader when customizing underlying storage format #296
Conversation
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.
Much cleaner and more robust. IMO the change is not confusing, one just has to use item loader on both sides.
What happens when I (erroneously) omit it?
It would break and tell you the wrong item loader has been provided. Ok, waiting on @awaelchli review and ideas ;) |
|
Hey @AugustDev. TokensLoader doesn't work on dictionary. It needs a 1D tensor. |
Before submitting
What does this PR do?
Until now, we had a hack where 1D tensor would be handled differentely and stored as contiguous array. I have seen several users complaining about this magic and unexpected behaviour.
WARNING: This PR is a breaking change for LLM using the TokensLoader. Now, we would need to pass the item_loader to the optimize or Cache directly to inform the underlying storage needs to be handled differently.
If no item_loader is passed during the optimization, this default to the Pytree handler.
For LLM tokens, here is the breaking API change.
Before
Now
Fixes #294
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in GitHub issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃