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

Torch compile + export escn #826

Merged
merged 26 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 22 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
10 changes: 10 additions & 0 deletions src/fairchem/core/common/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,13 @@ def spawn_multi_process(
)

return [mp_output_dict[i] for i in range(config.world_size)]

def init_local_distributed_process_group(backend="nccl"):
os.environ["MASTER_ADDR"] = "localhost"
os.environ["MASTER_PORT"] = str(get_free_port())
dist.init_process_group(
rank=0,
world_size=1,
backend=backend,
timeout=timedelta(seconds=10), # setting up timeout for distributed collectives
)
5 changes: 4 additions & 1 deletion src/fairchem/core/datasets/lmdb_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def sample_property_metadata(self, num_samples: int = 100):
}


def data_list_collater(data_list: list[BaseData], otf_graph: bool = False) -> BaseData:
def data_list_collater(data_list: list[BaseData], otf_graph: bool = False, to_dict: bool = False) -> BaseData | dict[str, torch.Tensor]:
batch = Batch.from_data_list(data_list)

if not otf_graph:
Expand All @@ -226,4 +226,7 @@ def data_list_collater(data_list: list[BaseData], otf_graph: bool = False) -> Ba
"LMDB does not contain edge index information, set otf_graph=True"
)

if to_dict:
batch = dict(batch.items())

return batch
Loading