Search code examples
pythonmachine-learningdeep-learninggoogle-colaboratory

How can I stop a particular cell from running in google colab?


If a cell is taking too long to run (for example, if it has code to train the model in deep learning) , how can I stop it from running in Google Colab.


Solution

  • Press the stop button, or select the 'Interrupt execution' item from the Runtime menu.

    enter image description here

    Keep in mind that some code cannot be interrupted. (For example, if you're using a C library stuck in a syscall.) In these cases, you can restart your Python process by selecting 'Restart runtime...' from the Runtime menu.