Skip to content

Commit

Permalink
another fix for cpu vs. cuda
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanemenecker committed Nov 4, 2024
1 parent 1110be9 commit be71b85
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions metapredict/backend/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def predict(inputs,

# get output values from the seq_vector based on the network (brnn_network)
with torch.no_grad():
outputs = model(seq_vector.float()).detach().numpy()[0]
outputs = model(seq_vector.float()).detach().cpu().numpy()[0]

# Take care of rounding and normalization
if normalized == True and round_values==True:
Expand Down Expand Up @@ -576,7 +576,7 @@ def predict(inputs,

# get output values from the seq_vector based on the network (brnn_network)
with torch.no_grad():
outputs = model(seq_vector.float()).detach().numpy()[0].flatten()
outputs = model(seq_vector.float()).detach().cpu().numpy()[0].flatten()

# Take care of rounding and normalization
if normalized == True and round_values==True:
Expand Down Expand Up @@ -1091,11 +1091,12 @@ def predict_pLDDT(inputs,

# encode the sequence
seq_vector = encode_sequence.one_hot(inputs)
seq_vector = seq_vector.to(device)
seq_vector = seq_vector.view(1, len(seq_vector), -1)

# get output values from the seq_vector based on the network (brnn_network)
with torch.no_grad():
outputs = model(seq_vector.float()).detach().numpy()[0]*multiplier
outputs = model(seq_vector.float()).detach().cpu().numpy()[0]*multiplier

# convert to disorder score if needed.
if return_as_disorder_score==True:
Expand Down Expand Up @@ -1179,11 +1180,12 @@ def predict_pLDDT(inputs,
for cur_seq_num, seq in enumerate(sequence_list):
# encode the sequence
seq_vector = encode_sequence.one_hot(seq)
seq_vector = seq_vector.to(device)
seq_vector = seq_vector.view(1, len(seq_vector), -1)

# get output values from the seq_vector based on the network (brnn_network)
with torch.no_grad():
outputs = model(seq_vector.float()).detach().numpy()[0].flatten()*multiplier
outputs = model(seq_vector.float()).detach().cpu().numpy()[0].flatten()*multiplier

# convert to disorder score if needed.
if return_as_disorder_score==True:
Expand Down

0 comments on commit be71b85

Please sign in to comment.