'FASTAI: 'LSTM' object has no attribute 'out' & attributeerror 'tuple' object has no attribute 'view'
I received these errors in my NLP model by running fit_one_cycle on a Learner object. I only managed to come across This source here with someone coming across the same problem. It helped me find a solution for me, which I am sharing here in case someone else come across this problem.
The tuple issue is due to the fact that the forward method returns a tuple of three tensors in the FastAI example whereas just a tensor is expected in the __call__ method. The issued appeared after some update of the functionality, this seems to be the case
Solution 1:[1]
You can solve this in two ways:
- Simply use a
TextLearnerobject without specifying the callback methods rather than theLearnerobject (Then the callbacks should automatically be set and these are ajour with functionality). (Recommended) - Replace the RNNRegularizer with the correct callback function (requries more customization)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | m_h |
