Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to terminate Colab session programmatically?

To save consumed compute units in Colab (as there's an option) to pay as you go, how to terminate / shut down Colab session using a code programmatically?

like image 436
Maged Avatar asked Jul 27 '26 02:07

Maged


1 Answers

Use the following function

from google.colab import runtime
runtime.unassign()

It will delete the currently connected runtime and disconnect the notebook. It's announced here.

like image 103
Maged Avatar answered Jul 28 '26 14:07

Maged



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!