Can't reproduce logistic regression example.
See original GitHub issue🐛 Bug
I am unable to run the logistic regression example . At training, I get error which ends in:
/usr/local/lib/python3.6/dist-packages/pl_bolts/models/regression/logistic_regression.py in validation_step(self, batch, batch_idx)
81 x = x.view(x.size(0), -1)
82 y_hat = self(x)
---> 83 acc = accuracy(y_hat, y)
84 return {'val_loss': F.cross_entropy(y_hat, y), 'acc': acc}
85
TypeError: 'module' object is not callable
Notably, I modified the example to not use TPUs.
Example code I follow is:
https://pytorch-lightning-bolts.readthedocs.io/en/latest/classic_ml.html#logistic-regression
To Reproduce
I tried to reproduce this in both Colab and as a python script in a fresh virtual env.
Colab notebook gist with full error and requirements:
https://gist.github.com/pavopax/e9040f42725322dfd2b86975e6ba5bbc
Also ran on Linux Python 3.7.1 with requirements:
https://gist.github.com/pavopax/d631dc61eceebbfbf67d9b113504f114
Code sample
I replace code example to remove TPUs:
trainer = pl.Trainer() #(tpu_cores=8, precision=16)
I use example code from: https://pytorch-lightning-bolts.readthedocs.io/en/latest/classic_ml.html#logistic-regression
For code, see gist above
Expected behavior
Code runs without errors and produces result
Environment
Colab with requirements as above
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (2 by maintainers)

Top Related StackOverflow Question
I confirm the issue is now resolved. Thanks for a fast and awesome issue resolution experience 💯 🙌
@pavopax Thank you for reporting the issue in detail! Could you try updating bolts with
pip install pytorch-lightning-bolts --upgrade? If you get an ImportError after updating, can you trypip install pytorch-lightning-bolts["extra"] --upgradeto install relevant modules?