I have a problem with my dataloader, it is define like this
# Define dataloader
class Mental(Dataset):
def __init__(self, X,y = None, _config = None):
self.X = X
self.y = y
self.tokenizer = AutoTokenizer.from_pretrained(_config['model_name'], do_lower_case=True)
def __len__(self):
return len(self.X)
def __getitem__(self, idx):
out=torch.tensor(self.tokenizer.encode(self.X[idx], max_length=128, pad_to_max_length=True, add_special_tokens=True))
if(self.y):
return {"text": out, "attention":(out!=1).float(), "label":torch.tensor(self.y[idx])}
else:
return {"text": out, "attention":(out!=1).float()}
but when I call the dataloader, I have this error
AttributeError Traceback (most recent call last)
/002/usuarios/maria.garcia/anaconda3/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj)
700 type_pprinters=self.type_printers,
701 deferred_pprinters=self.deferred_printers)
--> 702 printer.pretty(obj)
703 printer.flush()
704 return stream.getvalue()
/002/usuarios/maria.garcia/anaconda3/lib/python3.7/site-packages/IPython/lib/pretty.py in pretty(self, obj)
403 if cls is not object \
404 and callable(cls.__dict__.get('__repr__')):
--> 405 return _repr_pprint(obj, self, cycle)
406
407 return _default_pprint(obj, self, cycle)
/002/usuarios/maria.garcia/anaconda3/lib/python3.7/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
693 """A pprint that just redirects to the normal repr function."""
694 # Find newlines and replace them with p.break_()
--> 695 output = repr(obj)
696 lines = output.splitlines()
697 with p.group():
/002/usuarios/maria.garcia/.local/lib/python3.7/site-packages/datasets/arrow_dataset.py in __repr__(self)
1678
1679 def __repr__(self):
-> 1680 return f"Dataset({{\n features: {list(self.features.keys())},\n num_rows: {self.num_rows}\n}})"
1681
1682 @property
/002/usuarios/maria.garcia/.local/lib/python3.7/site-packages/datasets/arrow_dataset.py in features(self)
180 @property
181 def features(self) -> Features:
--> 182 return self._info.features
183
184 @property
AttributeError: 'Mental' object has no attribute '_info'
Everything was fine until yesterday, I don know what happened