-
Notifications
You must be signed in to change notification settings - Fork 3.4k
allow loras to be implicitly evicted and loaded based on max_loaded_loras #11526
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
Summary of ChangesHello @glenliu21, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a dynamic LoRA adapter management system that allows for implicit eviction and reloading of LoRAs based on usage and a configurable maximum loaded limit. This change aims to improve resource utilization and flexibility by transforming the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces an LRU caching mechanism for LoRA adapters, allowing them to be implicitly evicted and reloaded based on the max_loaded_loras setting. The changes are mostly well-implemented, using an OrderedDict for LRU tracking and adding logic for eviction and implicit reloading. I've found a critical issue in the eviction logic that could lead to exceeding the configured maximum number of loaded LoRAs. Additionally, there are some debug log statements that should be removed from the production code. The tests have been updated to cover the new functionality, which is great.
|
/gemini review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
/gemini review |
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.
Code Review
This pull request introduces a valuable feature for managing LoRA adapters by allowing them to be implicitly evicted and reloaded based on an LRU policy and a max_loaded_loras limit. The implementation is well-structured, using an OrderedDict for the LRU cache and refactoring the adapter loading/unloading logic for clarity and reuse. The accompanying tests are thorough and cover various scenarios, including eviction, reloading, and handling of pinned adapters, which is excellent.
My main feedback is to address a potential race condition in the implicit reloading logic within generate_request. I've provided a specific suggestion to make the implementation more robust by handling the return value of load_lora_adapter.
|
/gemini review |
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.
Code Review
This pull request introduces implicit LoRA adapter eviction and loading based on max_loaded_loras. It modifies LoRARegistry to use an OrderedDict for LRU management, adds methods for finding unregistered LoRAs and identifying the LRU LoRA, and updates TokenizerManager to handle implicit loading and unloading. The changes also include modifications to existing tests and the addition of new unit tests to ensure the correctness of the new features. I have provided review comments to address potential issues and improve the code.
|
x-posting one open topic from our Slack thread:
Perhaps we can continue our discussion in Slack. |
Motivation
This PR implements the feature in #10266.
Modifications
This PR introduces two new features:
max_loaded_lorasis no longer a hard limit. That is, if a LoRA adapter is loaded and causes the limit to be exceeded, then the LRU LoRA adapter will be evicted. Furthermore, pinned LoRA adapters can't be implicitly evicted.generateis called with a LoRA adapter that was previously loaded but now evicted, it will be reloaded. Note that LoRA adapters that haven't been explicitly loaded and then unloaded cannot be implicitly loaded.Accuracy Tests
Modified existing tests and added new unit tests.
Checklist