huggingface / accelerate

🚀 A simple way to launch, train, and use PyTorch models on almost any device and distributed configuration, automatic mixed precision (including fp8), and easy-to-configure FSDP and DeepSpeed support
https://huggingface.co/docs/accelerate
Apache License 2.0
7.71k stars 937 forks source link

`preload_module_classes` is lost in attach_execution_device_hook. #3060

Open wejoncy opened 3 weeks ago

wejoncy commented 3 weeks ago

System Info

https://github.com/huggingface/accelerate/blob/3fcc9461c4fcb7228df5e5246809ba09cfbb232e/src/accelerate/hooks.py#L439 Should we pass preload_module_classes to the next calling? such as

        attach_execution_device_hook(child, execution_device, tied_params_map=tied_params_map, 
 preload_module_classes=preload_module_classes)

Information

Tasks

Reproduction

Step into the code is enough.

Expected behavior

Identify the bug.

wejoncy commented 3 weeks ago

Hi @muellerzr Could you please take a look at it? Sorry if I ping the wrong contributor could you please help to recommend someone? Thanks