在Google Colab中依次运行代码单元 [英] Running code cells sequentially in google colab
问题描述
我想按顺序运行Google Colab中的代码单元.
I want to run the code cells in Google Colab in sequence.
例如:
单元格[1]
from catboost import CatBoostRegressor
#do something here
单元格[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.
当我在Kaggle内核中执行相同的操作时,它可以完美运行,即,首先执行cell [1],然后执行cell [2],依此类推.
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.
我曾尝试在Google Colab中搜索此内容,但未能给出答案.
I have tried searching for this in Google Colab but failed to come up with an answer.
推荐答案
要一次运行所有单元,只需按ctrl+F9
或转到顶部的运行时菜单,然后单击run all
选项,所有单元将一次运行.
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.
如果要一一运行,则只需转到顶部的runtime menu
并单击run after
选项,所有单元格就会一一运行.请注意一件事,如果要从顶部单元格运行,请将光标放在顶部单元格上,然后启动.
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.
这篇关于在Google Colab中依次运行代码单元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!