Skip to content

Commit

Permalink
debug: Check if layerdrop and padding actually need changing in a mul…
Browse files Browse the repository at this point in the history
…ti-GPU setup
  • Loading branch information
saattrupdan committed Sep 26, 2024
1 parent a9123ac commit 5100bf5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/scripts/finetune_asr_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ def main(config: DictConfig) -> None:
# hyperparameters
is_main_process = os.getenv("RANK", "0") == "0"
if os.getenv("WORLD_SIZE") is not None or torch.cuda.device_count() > 1:
if "layerdrop" in config.model and config.model.layerdrop != 0.0:
if is_main_process:
logger.info(
"Forcing `layerdrop` to be 0.0 as this is required in a multi-GPU "
"training"
)
config.model.layerdrop = 0.0
if "gradient_checkpointing" in config and config.gradient_checkpointing is True:
if is_main_process:
logger.info(
"Disabling gradient checkpointing as this is required in a multi-"
"GPU training"
)
config.gradient_checkpointing = False
if config.padding != "max_length":
if is_main_process:
logger.info(
"Forcing `padding` to be 'max_length' as this is required in a "
"multi-GPU training"
)
config.padding = "max_length"
# if "layerdrop" in config.model and config.model.layerdrop != 0.0:
# if is_main_process:
# logger.info(
# "Forcing `layerdrop` to be 0.0 as this is required in a multi-GPU "
# "training"
# )
# config.model.layerdrop = 0.0
# if config.padding != "max_length":
# if is_main_process:
# logger.info(
# "Forcing `padding` to be 'max_length' as this is required in a "
# "multi-GPU training"
# )
# config.padding = "max_length"

finetune(config=config)

Expand Down

0 comments on commit 5100bf5

Please sign in to comment.