Do Terminal processes stop if Mac sleeps? I'm running some Python machine learning programs through Terminal that take hours at a time to finish. If I leave my computer unattended it hibernates - the screen goes off and I have to type in my password again.

When this happens, does my script get cancelled, paused, or continue the same? I would hate to think that my script could be 99% finished, and then gets aborted because my computer went to sleep.
All processes get paused when the system goes to sleep, independent of whether the process is part of macOS, an application or some code you wrote on your own. After the system wakes up again, all processes will continue to run. 

PS: Processes which were waiting for network or disk data when going to sleep may run into timeouts though. But that can happen anyway so most processes should be able to handle that anyway.