Fix dtype getter
# What does this PR do?

This PR is a better fix for #17656 as I've had time to dive deeper into this issue. The problem does appear when the model is wrapped in a `DataParallel` object, and not just for PyTorch 1.5. 
_The documentation is not available anymore as the PR was closed or merged._<|||||>Errors seem all related to the current Hub failure, still, will wait for the site to be back online to relaunch them since this is not urgent :-)