Compare commits

...

1 Commits

Author SHA1 Message Date
Wing Lian
2b890ead05 fsdp fft loading on meta device 2024-08-11 22:18:04 -04:00

View File

@@ -655,6 +655,14 @@ def load_model(
if "device_map" in model_kwargs:
del model_kwargs["device_map"]
if cfg.fsdp and not cfg.adapter and cfg.local_rank != 0:
with init_empty_weights():
model = AutoModelForCausalLM.from_pretrained(
base_model,
config=model_config,
**model_kwargs,
)
else:
model = AutoModelForCausalLM.from_pretrained(
base_model,
config=model_config,