We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
y
import csv import deepchem as dc from deepchem.models.torch_models import InfoGraphModel # Generate sample dataset without y value with open('smiles.csv', 'w', newline='') as csvfile: fieldnames = ['smiles'] writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() for i in range(100): writer.writerow({'smiles': 'Cc1[nH]ccc1C(=O)N[C@@H](C)CNC(=O)c1cccc2[nH]ccc21'}) featurizer = dc.feat.MolGraphConvFeaturizer(use_edges=True) loader = dc.data.CSVLoader([], feature_field='smiles', featurizer=featurizer) dataset = loader.create_dataset('smiles.csv', data_dir='temp-dir') # Fit on model loss = model.fit(dataset, nb_epoch=1) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[4], line 1 ----> 1 loss = model.fit(dataset, nb_epoch=1) ... File ~/deepchem/models/torch_models/torch_model.py:921, in <listcomp>(.0) 918 input_tensors = [torch.as_tensor(x, device=self.device) for x in inputs] 919 if labels is not None: 920 labels = [ --> 921 x.astype(np.float32) if x.dtype == np.float64 else x 922 for x in labels 923 ] 924 label_tensors = [ 925 torch.as_tensor(x, device=self.device) for x in labels 926 ] 927 else: AttributeError: 'NoneType' object has no attribute 'dtype'
Potential Solution
Adding a check for y values before this line
deepchem/deepchem/models/torch_models/torch_model.py
Line 985 in ae7880e
None
[None]
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
To Reproduce
Potential Solution
Adding a check for
y
values before this linedeepchem/deepchem/models/torch_models/torch_model.py
Line 985 in ae7880e
to return
None
for y when it is None instead of returning[None]
.The text was updated successfully, but these errors were encountered: