I just wanted to report a solution to this problem:
I have been dealing with an issue where my iMac Retina 2014 would freeze with a black screen and require a reboot after a deep sleep. This has been going on for about 1 to 2 years now and I believe continued from El Capitan to the current version of Sierra (10.12.6). The problem may have either began after an OS upgrade or when I added a second monitor, a Dell P2715Q.
The iMac seemed to work fine all day. The problem would occur after leaving the computer for long periods of time, usually overnight, and would also may remote access difficult to impossible unless I set the System Preferences:Energy Saver:Turn display off after: to Never.
Since there were many issues about the Dell monitor found online, I was thinking this was the issue and tried every issue I could find online with no luck, including PRAM reset, SMC reset, reinstall OS.
The problem turned out to be iCloud. I signed off of iCloud in the System Preferences and have not had the problem since.
I am guessing when I upgraded the OS, it asked me to sign in to iCloud, and that's when all the problems began.
I am not sure if there is some way to use iCloud or change an iCloud setting to allow this to work, but at least now, all is well. My computer has not crashed, I can log in remotely, and all seems stable.