[Offloading] [Bugfix] Fix fully offloaded model saving - #47336
Conversation
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
|
looks good |
|
@Cyrilvallez PTAL |
| if hasattr(self, "hf_device_map") and ( | ||
| len(set(self.hf_device_map.values())) > 1 or "disk" in self.hf_device_map.values() |
There was a problem hiding this comment.
sure about this ? this will always be true in multi-gpu setup. len(set(self.hf_device_map.values())) > 1
There was a problem hiding this comment.
Yes, this condition is meant to be equivalent with this accelerate logic, which signifies when hooks are forced on the model.
Accelerate couples the concepts of "attaching hooks" and "offloading the weights".
There was a problem hiding this comment.
as discussed, can you fix this condition or revert the changes here ?
## Purpose ## * Support `HY_V3` model ## Prerequisites ## ### Transformers ### - [ ] huggingface/transformers#47336 ## Testing ## * Used to generate https://huggingface.co/RedHatAI/Hy3-NVFP4-FP8 --------- Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
|
Tested locally @pytest.mark.parametrize("device_map", [
{'model.visual': 0, 'model.language_model': 1, 'lm_head': 1},
{"model.visual":0,"model.language_model":"cpu" ,"lm_head": "cpu"},
{"model.visual":0,"model.language_model":"disk" ,"lm_head": "disk"},
{'model.visual': 0, 'model.language_model': 0, 'lm_head': 0},
{"model.visual":"cpu","model.language_model":"cpu" ,"lm_head": "cpu"},
{"model.visual":"disk","model.language_model":"disk" ,"lm_head": "disk"},
])
def test_save(device_map):
model = Qwen3VLMoeForConditionalGeneration.from_pretrained("inference-optimization/Qwen3-VL-1.0B-A0.4B-Instruct",device_map=device_map, offload_folder="offload_folder")
model.save_pretrained("tmp")The full disk offloading case fails without the current changes, which means these changes are effective and working |
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
|
@bot /style |
|
Style fix is beginning .... View the workflow run here. |
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Head branch was pushed to by a user without write access
|
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. |
CI recapDashboard: View test results in Grafana |
…7336) * fix Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> * remove breakpoint Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> * fix offloading condition Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> * fix format Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> --------- Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
…7336) * fix Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> * remove breakpoint Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> * fix offloading condition Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> * fix format Signed-off-by: Kyle Sayers <kylesayrs@gmail.com> --------- Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
Purpose
Changes
Testing
Qwen/Qwen3-30B-A3B#47333Suggested Reviewers