-
Notifications
You must be signed in to change notification settings - Fork 0
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
Ability to parallelize between GPUs #30
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
matsen
commented
Jun 6, 2024
•
edited
Loading
edited
- factoring apart load_and_add_shm...
- finding least used gpu and using it, with a default
- branch lengths are tensors
- simplifying device handling of crepes
The code changes modify the `pick_device` function in `common.py` to improve the CUDA device selection for a specific job. The print statement has been updated to include the job ID, providing more informative output. Based on the recent user commits and repository commits, it seems that there have been updates related to GPU selection and dataset movement. However, these commits do not directly relate to the current code changes. Please note that the commit message should not include any meta information such as issue references, tags, or author names.
Dropped: def model_and_optimizer_to(self, device):
self.model.to(device)
for state in self.optimizer.state.values():
for k, v in state.items():
if isinstance(v, torch.Tensor):
state[k] = v.to(device)
for dataset in [self.train_dataset, self.val_dataset]:
if dataset is not None:
dataset.to(device) |
Also deferred to a future issue: def dataset_of_pcp_df(pcp_df, branch_length_multiplier=5.0):
return DNSMDataset.from_data(
pcp_df["parents"],
pcp_df["children"],
pcp_df["rates"],
pcp_df["subs_probs"],
branch_length_multiplier=branch_length_multiplier,
)
def train_val_datasets_of_pcp_df(pcp_df, branch_length_multiplier=5.0):
"""
Perform a train-val split based on a "in_train" column.
"""
train_df = pcp_df[pcp_df["in_train"]].reset_index(drop=True)
val_df = pcp_df[~pcp_df["in_train"]].reset_index(drop=True)
val_dataset = dataset_of_pcp_df(
val_df,
branch_length_multiplier=branch_length_multiplier,
)
if len(train_df) == 0:
return None, val_dataset
# else:
train_dataset = dataset_of_pcp_df(
train_df,
branch_length_multiplier=branch_length_multiplier,
)
return train_dataset, val_dataset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.