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

allocate 80% for cpu is unset in max_memory #2219

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

Conversation

SunMarc
Copy link
Member

@SunMarc SunMarc commented Dec 5, 2023

What does this PR do ?

This PR modifies max_memory by allocating 80% of cpu memory of "cpu" is not passed in max_memory. The idea was in case the user did not specify the cpu allocation using max_memory arg, we should just infer from the current system available memory minus some reserved pool for the OS to continue to work. Otherwise, we will move directly to disk offload.
cc @mfuntowicz as you suggested.

Before this PR:

max_memory = {"0:"15GiB"}
get_max_memory(max_memory)
# returns {0: 16106127360}

After this PR

max_memory = {"0:"15GiB"}
get_max_memory(max_memory)
# returns {0: 16106127360,  'cpu': 384541448601.60004}

TODO:

  • check accelerate tests
  • check transformers tests

@SunMarc SunMarc changed the title add 80% for cpu allocate 80% for cpu is unset in max_memory Dec 5, 2023
@HuggingFaceDocBuilderDev

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.

Copy link
Collaborator

@muellerzr muellerzr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG2M, slight nit on the docstring

src/accelerate/utils/modeling.py Outdated Show resolved Hide resolved
@huggingface huggingface deleted a comment from github-actions bot Jan 5, 2024
Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot closed this Feb 8, 2024
@SunMarc SunMarc reopened this Feb 8, 2024
@github-actions github-actions bot closed this Feb 17, 2024
@SunMarc SunMarc reopened this Feb 20, 2024
@github-actions github-actions bot closed this Feb 29, 2024
@muellerzr muellerzr reopened this Feb 29, 2024
@muellerzr muellerzr added enhancement New feature or request feature request Request for a new feature to be added to Accelerate labels Feb 29, 2024
@muellerzr muellerzr added the wip Work in progress label Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request Request for a new feature to be added to Accelerate wip Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants