如何降级 Google Colab 的 Torch 版本

Sar*_*oud 6 python torch pytorch google-colaboratory

我想降级我的 Google Colab 笔记本中使用的 Torch 版本。我怎么能那样做?

Szy*_*zke 5

从你的单元格运行:

!pip install torch==version
Run Code Online (Sandbox Code Playgroud)

例如,版本可能在哪里1.3.0(默认为1.4.0)。您可能还必须torchvision适当降级,以便您选择:

!pip install torch==1.3.0 torchvision==0.4.1
Run Code Online (Sandbox Code Playgroud)

另一方面,PyTorch 提供主要版本之间的向后兼容性,因此不需要降级。

请记住,您必须重新启动 Google Colab 才能使更改生效