Commit 80b32a3a authored by Geoffrey Yu's avatar Geoffrey Yu
Browse files

update greedy_align just in case there are nan in rmsd calculation

parent 80f0d617
...@@ -1855,15 +1855,17 @@ def greedy_align( ...@@ -1855,15 +1855,17 @@ def greedy_align(
continue continue
j = int(next_asym_id - 1) j = int(next_asym_id - 1)
if not used[j]: # possible candidate if not used[j]: # possible candidate
while best_idx is None:
cropped_pos = true_ca_poses[j] cropped_pos = true_ca_poses[j]
mask = true_ca_masks[j][cur_residue_index] mask = true_ca_masks[j][cur_residue_index]
rmsd = compute_rmsd( rmsd = compute_rmsd(
cropped_pos, cur_pred_pos, (cur_pred_mask.to('cuda:0') * mask.to('cuda:0')).bool() cropped_pos, cur_pred_pos, (cur_pred_mask.to('cuda:0') * mask.to('cuda:0')).bool()
) )
print(f"rmsd is {rmsd}")
if rmsd < best_rmsd: if (rmsd is not None) and (rmsd < best_rmsd):
best_rmsd = rmsd best_rmsd = rmsd
best_idx = j best_idx = j
print(f"now best_idx is {best_idx} and rmsd is {rmsd} and j is {j}")
assert best_idx is not None assert best_idx is not None
used[best_idx] = True used[best_idx] = True
align.append((i, best_idx)) align.append((i, best_idx))
...@@ -2117,7 +2119,10 @@ class AlphaFoldMultimerLoss(AlphaFoldLoss): ...@@ -2117,7 +2119,10 @@ class AlphaFoldMultimerLoss(AlphaFoldLoss):
move_to_gpu = lambda t: (t.to('cuda:0')) move_to_gpu = lambda t: (t.to('cuda:0'))
features = tensor_tree_map(move_to_gpu,features) features = tensor_tree_map(move_to_gpu,features)
print(f"after moving features:",torch.cuda.memory_allocated(0)) print(f"after moving features:",torch.cuda.memory_allocated(0))
print(f"features is {type(features)} and out is {type(out)}")
# out = tensor_tree_map(move_to_gpu,out) # out = tensor_tree_map(move_to_gpu,out)
for k,v in out.items():
out[k] = v.to('cuda')
self.loss(out,features) self.loss(out,features)
return permutated_labels return permutated_labels
## TODO next need to check how the ground truth label is used ## TODO next need to check how the ground truth label is used
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment