Skip to content

Commit

Permalink
fix trainer device while infer; fix read_data from dict when get repr… (
Browse files Browse the repository at this point in the history
#214)

fix trainer device while infer; fix read_data from dict when get repr without "target" key

Co-authored-by: cuiyaning <cuiyaning@dp.tech>
  • Loading branch information
emotionor and emotionor authored Apr 15, 2024
1 parent c458c0f commit 37c6ddc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion unimol_tools/unimol_tools/data/datareader.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def read_data(self, data=None, is_train=True, **params):
for i in range(label.shape[1]):
data[target_col_prefix + str(i)] = label[:,i]

_ = data.pop('target')
_ = data.pop('target', None)
data = pd.DataFrame(data).rename(columns={smiles_col: 'SMILES'})

elif isinstance(data, list):
Expand Down
2 changes: 1 addition & 1 deletion unimol_tools/unimol_tools/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def get_repr(self, data=None, return_atomic_reprs=False):
**self.params,
)
dataset = MolDataset(datahub.data['unimol_input'])
self.trainer = Trainer(task='repr')
self.trainer = Trainer(task='repr', cuda=self.device)
repr_output = self.trainer.inference(self.model,
return_repr=True,
return_atomic_reprs=return_atomic_reprs,
Expand Down

0 comments on commit 37c6ddc

Please sign in to comment.