You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to get access to the batch_size in my predict_step to calculate the correct output index.
But the self.trainer.predict_dataloaders[0].batch_size always return None instead of the correct batch size.
I tried doing the same thing to self.trainer.test_dataloaders[0].batch_size and everything works fine. So I highly suspect that it is a bug for self.trainer.predict_dataloaders[0].batch_size.
The example code below should return 32 when trainer.test(model, trainloader) or trainer.predict(model, predictloader) is executed.
But when trainer.predict(model, predictloader) is executed, it returns None
This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions - the Lightning Team!
My recommendation is that users access the batch size by batch.size(0) (first dimension of your tensor) or by other means (e.g. storing the configuration).
Bug description
I need to get access to the
batch_size
in mypredict_step
to calculate the correct output index.But the
self.trainer.predict_dataloaders[0].batch_size
always returnNone
instead of the correct batch size.I tried doing the same thing to
self.trainer.test_dataloaders[0].batch_size
and everything works fine. So I highly suspect that it is a bug forself.trainer.predict_dataloaders[0].batch_size
.The example code below should return
32
whentrainer.test(model, trainloader)
ortrainer.predict(model, predictloader)
is executed.But when
trainer.predict(model, predictloader)
is executed, it returnsNone
How to reproduce the bug
Error messages and logs
Environment
The text was updated successfully, but these errors were encountered: