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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With