Skip to content

Commit

Permalink
Revert "Replace FSDP args (#1517)"
Browse files Browse the repository at this point in the history
This reverts commit 83ab9c3.
  • Loading branch information
KuuCi authored Sep 17, 2024
1 parent 0114f33 commit 343dcd8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
8 changes: 2 additions & 6 deletions llmfoundry/command_utils/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def evaluate_model(
device_eval_batch_size: Union[int, float],
eval_gauntlet_config: Optional[Union[str, dict[str, Any]]],
eval_loader_config: Optional[Union[dict[str, Any], list[dict[str, Any]]]],
parallelism_config: Optional[dict[str, Any]],
fsdp_config: Optional[dict[str, Any]],
loggers: list[LoggerDestination],
python_log_level: Optional[str],
precision: str,
Expand Down Expand Up @@ -99,10 +99,6 @@ def evaluate_model(
mosaicml_logger.log_metrics(metadata)
mosaicml_logger._flush_metadata(force_flush=True)

fsdp_config = parallelism_config.get(
'fsdp_config',
None,
) if parallelism_config else None
if fsdp_config and model.get('load_in_8bit', False):
raise ValueError(
'The FSDP config block is not supported when loading ' +
Expand Down Expand Up @@ -320,7 +316,7 @@ def evaluate(cfg: DictConfig) -> tuple[list[Trainer], pd.DataFrame]:
device_eval_batch_size=eval_config.device_eval_batch_size,
eval_gauntlet_config=eval_gauntlet_config,
eval_loader_config=eval_loader_config,
parallelism_config={'fsdp': fsdp_config},
fsdp_config=fsdp_config,
loggers=loggers,
python_log_level=eval_config.python_log_level,
precision=eval_config.precision,
Expand Down
5 changes: 2 additions & 3 deletions tests/a_scripts/inference/test_convert_composer_to_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,7 @@ def test_huggingface_conversion_callback(
model=original_model,
device='gpu',
precision=trainer_precision,
parallelism_config={'fsdp': fsdp_config}
if fsdp_state_dict_type is not None else None,
fsdp_config=fsdp_config if fsdp_state_dict_type is not None else None,
train_dataloader=train_dataloader,
save_folder=os.path.join(tmp_path, 'checkpoints'),
save_interval=save_interval,
Expand Down Expand Up @@ -1470,7 +1469,7 @@ def test_mptmoe_huggingface_conversion_callback(
trainer = Trainer(
model=original_model,
device='gpu',
parallelism_config={'fsdp': fsdp_config},
fsdp_config=fsdp_config,
train_dataloader=train_dataloader,
save_folder=os.path.join(tmp_path, 'checkpoints'),
save_interval=save_interval,
Expand Down
2 changes: 1 addition & 1 deletion tests/models/hf/test_fsdp_weight_tying.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_fsdp_weight_tying(
trainer = Trainer(
model=original_model,
device='gpu',
parallelism_config={'fsdp': fsdp_config},
fsdp_config=fsdp_config,
train_dataloader=[],
device_train_microbatch_size=1,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/models/hf/test_hf_peft_wrapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_lora_mixed_init(
trainer = Trainer(
model=original_model,
device='gpu',
parallelism_config={'fsdp': fsdp_config},
fsdp_config=fsdp_config,
train_dataloader=[],
device_train_microbatch_size=1,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_fsdp_act_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_fsdp_act_checkpoint(
trainer = Trainer(
model=model,
device='gpu',
parallelism_config={'fsdp': fsdp_config},
fsdp_config=fsdp_config,
)

assert trainer.state.fsdp_enabled
Expand Down

0 comments on commit 343dcd8

Please sign in to comment.