Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running code cells sequentially in google colab

I want to run the code cells in Google Colab in sequence.

For example:

Cell[1]

from catboost import CatBoostRegressor
#do something here

Cell[2]

clf = CatBoostRegressor(task_type='GPU')
#do some more things here

But when I select "Run all" all cells seem to run in parallel, so my code does not work.

When I do the same thing in a Kaggle Kernel it runs perfectly i.e, first cell[1] is executed, and then cell[2] and so on.

I have tried searching for this in Google Colab but failed to come up with an answer.

like image 859
Ahsan Tarique Avatar asked Mar 13 '19 05:03

Ahsan Tarique


2 Answers

To run all cells at a time just press ctrl+F9 or go to runtime menu on top and click run all option and all cells run at a time.

If you want to run one by one then just go to runtime menu on top and click run after option and all cells run one by one. Note one thing that if you want to run from top cell then place cursor on top cell and then start.

like image 88
Jainmiah Avatar answered Oct 06 '22 03:10

Jainmiah


Run all does indeed run cells sequentially, e.g.,

enter image description here

Can you share a self-contained notebook that reproduces the problem you observe? I suspect the issue is something other than sequential execution.

like image 30
Bob Smith Avatar answered Oct 06 '22 03:10

Bob Smith