-
Notifications
You must be signed in to change notification settings - Fork 31.7k
[offload] respect max_memory argument when factoring in unused reserved memory
#37982
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
Conversation
|
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the |
|
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. |
ydshieh
left a comment
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 to me although not diving into the details 💯 !
max_memory argumentmax_memory argument when factoring in unused reserved memory
Cyrilvallez
left a comment
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.
Ha, this got through the radar indeed! Thanks! Though I believe we can simply check unused_memory when max_memory is set, to keep the exact same behavior
| max_memory[device_name] += unused_memory | ||
| device_map_kwargs["max_memory"] = max_memory | ||
| inferred_max_memory[device_name] += unused_memory | ||
| # respect the `max_memory` passed by the user | ||
| if max_memory is not None and device_name in max_memory: | ||
| inferred_max_memory[device_name] = min(inferred_max_memory[device_name], max_memory[device_name]) |
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.
Probably easier to check unused_memory only if max_memory is not None and device_name in max_memory no?
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.
(chatted on slack)
As discussed internally, since huggingface/transformers#37982, some multi-GPU tests started failing because all parameters are loaded onto a single GPU. This should now be fixed by providing an explicit device_map instead of relying on "auto". Furthermore, for an unknown reason, the HQQ test started failing as the correlation dipped below 0.97 -- to 0.9696 actually. I think this is close enough to not warrant further investigation. Therefore, I only decreased the threshold.
As discussed internally, since huggingface/transformers#37982, some multi-GPU tests started failing because all parameters are loaded onto a single GPU. This should now be fixed by providing an explicit device_map instead of relying on "auto". Furthermore, for an unknown reason, the HQQ test started failing as the correlation dipped below 0.97 -- to 0.9696 actually. I think this is close enough to not warrant further investigation. Therefore, I only decreased the threshold.
As discussed internally, since huggingface/transformers#37982, some multi-GPU tests started failing because all parameters are loaded onto a single GPU. This should now be fixed by providing an explicit device_map instead of relying on "auto". Furthermore, for an unknown reason, the HQQ test started failing as the correlation dipped below 0.97 -- to 0.9696 actually. I think this is close enough to not warrant further investigation. Therefore, I only decreased the threshold.
What does this PR do?
Our daily CI had >1000 new failures since #37920, on tests that use the
max_memoryargument infrom_pretrained. This is because we now recapture unused reserved GPU memory, which caused us to go beyond the user-definedmax_memory. This PR fixes it.Affected tests, which set
max_memory:test_cpu_offloadtest_disk_offload_bintest_model_parallelism