Skip to content

Commit 2fcbb2b

Browse files
authored
Merge pull request #344 from geometric-intelligence/guille/configs_and_tests
Fix ADME tests
2 parents 627446a + 8278c45 commit 2fcbb2b

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

topobench/data/loaders/graph/adme_datasets.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
from omegaconf import DictConfig
88
from torch_geometric.data import Data, InMemoryDataset
99

10+
try:
11+
from ogb.utils.mol import smiles2graph
12+
from tdc.single_pred import ADME
13+
14+
_ADME_DEPS_AVAILABLE = True
15+
except ImportError:
16+
_ADME_DEPS_AVAILABLE = False
17+
1018
from topobench.data.loaders.base import AbstractLoader
1119

1220

@@ -64,14 +72,11 @@ def load_dataset(self) -> InMemoryDataset:
6472
ImportError
6573
If `PyTDC` or `rdkit` (via `ogb`) are not installed.
6674
"""
67-
try:
68-
from ogb.utils.mol import smiles2graph
69-
from tdc.single_pred import ADME
70-
except ImportError as e:
75+
if not _ADME_DEPS_AVAILABLE:
7176
raise ImportError(
7277
"ADME datasets require additional dependencies. "
7378
"Install them with: pip install PyTDC rdkit"
74-
) from e
79+
)
7580

7681
class _ADMEDataset(InMemoryDataset):
7782
"""Internal InMemoryDataset for ADME data.

0 commit comments

Comments
 (0)