Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
schinto opened this issue Sep 10, 2021 · 2 comments
Closed

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

schinto opened this issue Sep 10, 2021 · 2 comments

Comments

@schinto
Copy link

schinto commented Sep 10, 2021

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'
@KiddoZhu
Copy link
Member

Hi! This has already been fixed in #24. Please clone the latest repo and it should be fine.

We will update the conda package soon.

@KiddoZhu
Copy link
Member

Conda updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants