set env var for FSDP layer to wrap (#453)

This commit is contained in:
Wing Lian
2023-08-21 16:43:22 -04:00
committed by GitHub
parent 5e9c6afa10
commit 5a1985ba24

View File

@@ -377,6 +377,10 @@ def setup_fsdp_envs(cfg):
os.environ["FSDP_SYNC_MODULE_STATES"] = "true"
if cfg.fsdp_config.fsdp_state_dict_type:
os.environ["FSDP_STATE_DICT_TYPE"] = cfg.fsdp_config.fsdp_state_dict_type
if cfg.fsdp_config.fsdp_transformer_layer_cls_to_wrap:
os.environ[
"FSDP_TRANSFORMER_CLS_TO_WRAP"
] = cfg.fsdp_config.fsdp_transformer_layer_cls_to_wrap
def setup_trainer(cfg, train_dataset, eval_dataset, model, tokenizer, total_num_steps):