Skip to content
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

feat: support lazy loading the lora module for reducing the loading p… #434

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

thincal
Copy link
Contributor

@thincal thincal commented Apr 23, 2024

What does this PR do?

Fixes #433

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Was this discussed/approved via a Github issue or the discord / slack channel? Please add a link
    to it if that's the case.
  • Did you write any new necessary tests?

Who can review?

@tgaddair

@thincal thincal marked this pull request as draft April 23, 2024 10:55
@thincal thincal marked this pull request as ready for review April 23, 2024 13:36
@thincal
Copy link
Contributor Author

thincal commented Apr 24, 2024

It seems that caching the handle from safe_open might be a better solution, but need to consider the file handle reference management that used by multiple layers, I will refine it later.

@thincal thincal force-pushed the feat/support-lazy-loading-lora-module branch from bad816f to 9b1ac96 Compare May 19, 2024 02:03
@thincal
Copy link
Contributor Author

thincal commented May 19, 2024

It seems that caching the handle from safe_open might be a better solution, but need to consider the file handle reference management that used by multiple layers, I will refine it later.

Still keep cache the filenames instead of filehandles, since that 1) safe_open needs the device info which differs during loading the lora modules, 2) safe_open is lazy loading until specific tensor loaded by get_tensor invoked, which is already the optimized behavior for our case.

@thincal
Copy link
Contributor Author

thincal commented May 19, 2024

@tgaddair could you help review this change ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the latency of load_batched_adapter_weights
1 participant