Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable ddp find_unused_parameterse #111

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions pangaea/run.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import hashlib
import os as os
import pathlib
import pprint
import time
import hashlib

import hydra
import torch
Expand Down Expand Up @@ -39,7 +39,9 @@ def get_exp_info(hydra_config: HydraConf) -> dict[str, str]:
str: experiment information.
"""
choices = OmegaConf.to_container(hydra_config.runtime.choices)
cfg_hash = hashlib.sha1(OmegaConf.to_yaml(hydra_config).encode(), usedforsecurity=False).hexdigest()[:6]
cfg_hash = hashlib.sha1(
OmegaConf.to_yaml(hydra_config).encode(), usedforsecurity=False
).hexdigest()[:6]
timestamp = time.strftime("%Y%m%d_%H%M%S", time.localtime())
fm = choices["encoder"]
decoder = choices["decoder"]
Expand Down Expand Up @@ -133,7 +135,10 @@ def main(cfg: DictConfig) -> None:
)
decoder.to(device)
decoder = torch.nn.parallel.DistributedDataParallel(
decoder, device_ids=[local_rank], output_device=local_rank
decoder,
device_ids=[local_rank],
output_device=local_rank,
find_unused_parameters=cfg.finetune,
)
logger.info(
"Built {} for with {} encoder.".format(
Expand Down Expand Up @@ -185,10 +190,13 @@ def main(cfg: DictConfig) -> None:
logger=logger,
)
raw_val_dataset = GeoFMSubset(raw_val_dataset, indices)


train_dataset = GeoFMDataset(raw_train_dataset, train_preprocessor, cfg.data_replicate)
val_dataset = GeoFMDataset(raw_val_dataset, val_preprocessor, cfg.data_replicate)

train_dataset = GeoFMDataset(
raw_train_dataset, train_preprocessor, cfg.data_replicate
)
val_dataset = GeoFMDataset(
raw_val_dataset, val_preprocessor, cfg.data_replicate
)

logger.info("Built {} dataset.".format(cfg.dataset.dataset_name))

Expand Down
Loading