Shivanandroy / simpleT5

simpleT5 is built on top of PyTorch-lightning⚡️ and Transformers🤗 that lets you quickly train your T5 models.
MIT License
382 stars 61 forks source link

'SimpleT5' object has no attribute 'device' #20

Open athack opened 2 years ago

athack commented 2 years ago

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/user/.virtualenvs/t5/lib/python3.8/site-packages/simplet5/simplet5.py", line 442, in predict input_ids = input_ids.to(self.device) AttributeError: 'SimpleT5' object has no attribute 'device'

mahowak commented 2 years ago

I am having the same issue. Is there a fix for this?

pashok3d commented 2 years ago

You need to add use_gpu argument in predict function, then add the same code block as in load_model to set self.device attribute properly. @Shivanandroy

savasy commented 1 year ago

Or Simply call `` import torch

model.device= torch.device("cpu") ``

ke-lara commented 11 months ago

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/user/.virtualenvs/t5/lib/python3.8/site-packages/simplet5/simplet5.py", line 442, in predict input_ids = input_ids.to(self.device) AttributeError: 'SimpleT5' object has no attribute 'device'

Did you 'load_model' before 'predict'?