Skip to content

Commit

Permalink
fixing preprocessing issue with gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
eghbalz committed Apr 7, 2020
1 parent 8fe84ba commit 25912a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# pip install -U Flask
# pip install -U flask-cors
# conda install -c anaconda h5py
# pip install PeptideBuilder
# pip install requests
# git clone https://github.com/JeppeHallgren/pytorch-crf.git
# cd pytorch-crf/
# pip install -r requirements.txt
# pip install -e .

8 changes: 6 additions & 2 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ def calculate_dihedral_angles_over_minibatch(atomic_coords_padded, batch_sizes,
atomic_coords = atomic_coords_padded.transpose(0, 1)
for idx, _ in enumerate(batch_sizes):
angles.append(calculate_dihedral_angles(atomic_coords[idx][:batch_sizes[idx]], use_gpu))
return torch.nn.utils.rnn.pad_packed_sequence(
torch.nn.utils.rnn.pack_sequence(angles))
# this was problematic:
packed_angles = torch.nn.utils.rnn.pack_sequence(angles)
if use_gpu:
packed_angles=packed_angles.cuda()
angles_padded = torch.nn.utils.rnn.pad_packed_sequence(packed_angles)

return angles_padded

def protein_id_to_str(protein_id_list):
_aa_dict_inverse = {v: k for k, v in AA_ID_DICT.items()}
Expand Down

0 comments on commit 25912a3

Please sign in to comment.