Based on the error message and stack trace, it seems you might be mixing PyTorch versions.
Did you copy the adam.py file manually or is the error pointing to your local PyTorch installation?
adam.py doesn’t contain this particular line of code anymore, as the .data attribute is deprecated.