System shuts down automatically when training model

I am using Ubuntu 18.04. I got NVIDIA GTX 1060 with nvidia drivers v415. Every time I train the model on GPU while on battery power, system automatically shuts down. But, when I am connected to power, it doesnt happen. I am not sure as to what is causing this problem. Has anyone faced such a problem ?
Any help would be appreciated.

Was the system working before?
Does your laptop restart, crash or goes to sleep mode?
Could you check the battery status in the settings?
Did you upgrade your laptop with the GTX 1060 or was it already built in?

I use Dell G7 with a built in NVIDIA GTX 1060. Couple of times the “Power Off” dialog box popped up and it immediately shut down, and sometimes it shuts down abruptly(may be crashing) throwing a black screen. But, when I’m plugged into a power source, it runs perfect.

Your PSU might be a problem, if it was working before.
Also, have you checked if your laptop uses the GPU at all when in battery mode?
I’m not familiar with this specific machine, but I would guess some laptops might switch to the on-board graphic processor when not plugged in to save energy.

The same is happening with me. Lenovo Legion y-540, Ubuntu 18, RTX-2060(6gb). My laptop automatically shuts down after a few epochs of training on GPU. I was training a multi-class text classification model using RNN+CNN. I think it’s a memory issue. But in my case, I have set the GPU only for CUDA. My laptop graphic runs on Intel Integrated HD card.

I don’t really know why this happens. And it only happens for multi-class text classification and not binary text classification (possibly a memory issue).

Any leads on this?

Any update on this, as I am having the same laptop. I was able to train models on GPU while using Ubuntu 18, but since I installed Ubuntu 20, its shutting down as I start to train a model.