AttributeError: 'NoneType' object has no attribute 'dtype'

Same boat here. If it helps, I was getting my error at loss and so I printed it and got None. This is my case. Perhaps it’s not computing for some reason.

`use_cache = True` is incompatible with gradient checkpointing`. Setting `use_cache = False`...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_3879877/1790787526.py in <cell line: 7>()
     14         loss = outputs.loss
     15         print(loss)
---> 16         loss.backward()
     17 
     18         optimizer.step()

AttributeError: 'NoneType' object has no attribute 'backward'