Prediction using Pytorch Lightning #17764
Unanswered
sraghavm
asked this question in
code help: CV
Replies: 2 comments
-
lass SoftOrdering1DCNN(pl.LightningModule):
This is my my Network. Everything is running fine - train, test etc. But predict_step not working |
Beta Was this translation helpful? Give feedback.
0 replies
-
This is the link to Google colab file. Please help me understand this issue |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
predict_step is thrrows following error
AttributeError Traceback (most recent call last)
/tmp/ipykernel_5454/4136182478.py in
----> 1 predictions = trainer.predict(dataloaders=data_loader)
~/venv/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py in predict(self, model, dataloaders, datamodule, return_predictions, ckpt_path)
891 self.strategy._lightning_module = model
892 return call._call_and_handle_interrupt(
--> 893 self, self._predict_impl, model, dataloaders, datamodule, return_predictions, ckpt_path
894 )
895
~/venv/lib/python3.7/site-packages/pytorch_lightning/trainer/call.py in _call_and_handle_interrupt(trainer, trainer_fn, *args, **kwargs)
36 return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
37 else:
---> 38 return trainer_fn(*args, **kwargs)
39
40 except _TunerExitException:
~/venv/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py in _predict_impl(self, model, dataloaders, datamodule, return_predictions, ckpt_path)
936 self._predicted_ckpt_path = self.ckpt_path # TODO: remove in v1.8
937
--> 938 results = self._run(model, ckpt_path=self.ckpt_path)
939
940 assert self.state.stopped
...
--> 300 if input.dim() != 2 and input.dim() != 3:
301 raise ValueError(
302 "expected 2D or 3D input (got {}D input)".format(input.dim())
AttributeError: 'list' object has no attribute 'dim'``
Beta Was this translation helpful? Give feedback.
All reactions