You'll feel worse on 2 hours of sleep compared to 0 hours of sleep. Even if you manage to wake yourself up, you'll have a headache, and your brain will be in sleep mode rather than tired mode. You might as well drink a bunch of caffeine and tough it out, then go to sleep as soon as you are done with class. Make sure to take really good notes because you won't remember shit from this class.