我的目标是通过 jupyter notebook 从我的本地机器连接到 goocle colab gpu
从文档中做这些事情:
pip install jupyter_http_over_ws
jupyter serverextension enable --py jupyter_http_over_ws
用这个命令打开 jupyter:
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
在我像这样从终端使用我的 url 连接到 colab 之后:
在这之后我在我的终端中得到了这个
[I 18:12:04.374 NotebookApp] 302 GET /?token=HERE IS MY TOKEN (MY IP) 0.000000ms
实际上知道什么是302 GET
最后,如果我在 Colab 中使用 os.getcwd()
,它会显示我 PC 上的 LOCAL 目录
而 print(torch.cuda.is_available())
是 False
所以我已经从我的机器连接到 Colab,但反之亦然,在我的本地机器上获得 GPU。所以也许我做错了什么。
答案 0 :(得分:2)
我认为你错了。
Colab
只是 GUI
,它可以在网络浏览器和普通 Google 网络服务器(可以访问 Google Drive)上运行,而不是在带有 GPU
的特殊 Google 服务器上运行。
Colab
可以连接到 hosted runtime
这意味着 Google 服务器(硬件)with GPU
- 然后您可以直接访问此服务器上的文件,您可以使用 {{1} 在硬件上运行代码}}。
或者它可以连接到 GPU
这意味着您的本地计算机(硬件)local runtime
- 然后您可以直接访问本地文件并且您只能在本地硬件上运行代码。
您无法同时访问两个运行时(硬件)。
我是这么看的
使用 GPU/TPU 连接到 Google 服务器:
在没有 GPU 的情况下连接到本地计算机: