-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add keep_ram_copy_of_weights
config option
#7565
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…dModelWithPartialLoad when we are not storing a CPU copy of the state dict (i.e. when keep_ram_copy_of_weights=False).
github-actions
bot
added
python
PRs that change python files
backend
PRs that change backend files
services
PRs that change app services
python-tests
PRs that change python tests
labels
Jan 16, 2025
9 tasks
RyanJDick
requested review from
lstein,
blessedcoolant,
brandonrising,
hipsterusername and
psychedelicious
as code owners
January 16, 2025 23:57
hipsterusername
approved these changes
Jan 17, 2025
psychedelicious
approved these changes
Jan 17, 2025
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.
Looks good. I like the one-at-a-time weights xfer to reduce peak memory!
RyanJDick
added a commit
that referenced
this pull request
Jan 17, 2025
## Summary This PR revises the logic for calculating the model cache RAM limit. See the code for thorough documentation of the change. The updated logic is more conservative in the amount of RAM that it will use. This will likely be a better default for more users. Of course, users can still choose to set a more aggressive limit by overriding the logic with `max_cache_ram_gb`. ## Related Issues / Discussions - Should help with #7563 ## QA Instructions Exercise all heuristics: - [x] Heuristic 1 - [x] Heuristic 2 - [x] Heuristic 3 - [x] Heuristic 4 ## Merge Plan - [x] Merge #7565 first and update the target branch ## Checklist - [x] _The PR has a short but descriptive title, suitable for a changelog_ - [x] _Tests added / updated (if applicable)_ - [x] _Documentation added / updated (if applicable)_ - [ ] _Updated `What's New` copy (if doing a release after this PR)_
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backend
PRs that change backend files
python
PRs that change python files
python-tests
PRs that change python tests
services
PRs that change app services
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a
keep_ram_copy_of_weights
config option. The default (and legacy) behavior istrue
. The tradeoffs for this setting are as follows:keep_ram_copy_of_weights: true
: Faster model switching and LoRA patching.keep_ram_copy_of_weights: false
: Lower average RAM load (may not help significantly with peak RAM).Related Issues / Discussions
QA Instructions
Test with
enable_partial_load: false
andkeep_ram_copy_of_weights: false
.Test with
enable_partial_load: false
andkeep_ram_copy_of_weights: true
.Test with
enable_partial_load: true
andkeep_ram_copy_of_weights: false
.Test with
enable_partial_load: true
andkeep_ram_copy_of_weights: true
.Smoke test CPU-only and MPS with default configs.
Merge Plan
Checklist
What's New
copy (if doing a release after this PR)