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

Small issue in atom2valence dictionary iteration in Molecule.is_valid #236

Open
UmarZein opened this issue Nov 20, 2023 · 0 comments
Open

Comments

@UmarZein
Copy link

UmarZein commented Nov 20, 2023

specs:
Python 3.11.4 (i am using my fork of torchdrug only to alleviate versioning constraints)
torch.__version__: 2.1.0+cu118
torchdrug.__version__: 0.2.1


calling Molecule.is_valid gives me the following error:

File ~\anaconda3\Lib\site-packages\torchdrug\data\molecule.py:521, in Molecule.is_valid(self)
    519 # TODO: cross-check by any domain expert
    520 atom2valence = torch.tensor(float("nan")).repeat(constant.NUM_ATOM)
--> 521 for k, v in self.atom2valence:
    522     atom2valence[k] = v
    523 atom2valence = torch.as_tensor(atom2valence, device=self.device)

TypeError: cannot unpack non-iterable int object

Wouldn't using dict.items() be the correct way to iterate over key-value pairs in a dict, as it is the case in PackerMolecule.is_valid?

for k,v in self.atom2valence.items():
Shashank1202 added a commit to Shashank1202/torchdrug that referenced this issue Aug 22, 2024
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

1 participant