mirror of
https://github.com/huggingface/accelerate.git
synced 2025-10-20 10:03:46 +08:00
fix (skip) cache flush when original device is cpu
and offloaded to disk meta
(#3796)
This commit is contained in:
committed by
GitHub
parent
14383311c2
commit
057edec226
@ -404,7 +404,7 @@ def set_module_tensor_to_device(
|
||||
module.weight = module.weight.cuda(device_index)
|
||||
|
||||
# clean pre and post forward hook
|
||||
if clear_cache and device != "cpu":
|
||||
if clear_cache and device not in ("cpu", "meta"):
|
||||
clear_device_cache()
|
||||
|
||||
# When handling tied weights, we update tied_params_map to keep track of the tied weights that have already been allocated on the device in
|
||||
|
Reference in New Issue
Block a user