使用Google的Colab+pytorch

  • 打开Google的Colab

  • 运行:

!pip install torch
!pip install torchtext
!pip install torchvision

# K80 gpu for 12 hours
import torch
from torch import nn, optim
from torchtext import data, datasets

print('GPU:', torch.cuda.is_available())

torch.manual_seed(123)

在Colab中设置GPU加速:修改-->笔记本设置-->硬件加速(GPU加速)

猜你喜欢

转载自www.cnblogs.com/douzujun/p/13374918.html