Skip to content

AttributeError: 'USPTO50k' object has no attribute 'lazy' #30

@schinto

Description

@schinto

Running the retrosynthesis tutorial, the following error occurred

import torchdrug
print(torchdrug.__version__)

0.1.0

from torchdrug import datasets

reaction_dataset = datasets.USPTO50k("~/Projects/drugs/molecule-datasets/",
                                     node_feature="center_identification",
                                     kekulize=True)
synthon_dataset = datasets.USPTO50k("~/Projects/drugs/molecule-datasets/", as_synthon=True,
                                    node_feature="synthon_completion",
                                    kekulize=True)

from torchdrug.utils import plot

for i in range(2):
    sample = reaction_dataset[i]
    reactant, product = sample["graph"]
    reactants = reactant.connected_components()[0]
    products = product.connected_components()[0]
    plot.reaction(reactants, products)
AttributeError: 'USPTO50k' object has no attribute 'lazy'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/var/folders/zq/yt7gftfj7_x_11psy591dtz00000gn/T/ipykernel_6673/2093549361.py in <module>
      2 
      3 for i in range(2):
----> 4     sample = reaction_dataset[i]
      5     reactant, product = sample["graph"]
      6     reactants = reactant.connected_components()[0]

~/opt/anaconda3/envs/drugs/lib/python3.8/site-packages/torchdrug/data/dataset.py in __getitem__(self, index)
    138     def __getitem__(self, index):
    139         if isinstance(index, int):
--> 140             return self.get_item(index)
    141 
    142         index = self._standarize_index(index, len(self))

~/opt/anaconda3/envs/drugs/lib/python3.8/site-packages/torchdrug/data/dataset.py in get_item(self, index)
    127 
    128     def get_item(self, index):
--> 129         if self.lazy:
    130             item = {"graph": data.Molecule.from_smiles(self.smiles_list[index], **self.kwargs)}
    131         else:

AttributeError: 'USPTO50k' object has no attribute 'lazy'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions