首页 > 解决方案 > Problems setting up FastAi working on Colab

问题描述

I'm trying to work through a tutorial on CycleGANs using the Colab platform but I'm struggling to find a way through the 'simple' part of just importing libraries.

I'm just trying to import the following:

from fastai.conv_learner import *
from fastai.dataset import *
from cgan.options.train_options import *
from sklearn.model_selection import train_test_split
from cgan.options.train_options import TrainOptions
from cgan.data.data_loader import CreateDataLoader
from cgan.models.models import create_model
from cgan.util.visualizer import Visualizer
from google_images_download import google_images_download

I'm currently stuck with an error on the first line:

----> 7 class IntermediateLayerGetter(nn.ModuleDict):
      8     """
      9     Module wrapper that returns intermediate layers from a model

AttributeError: module 'torch.nn' has no attribute 'ModuleDict'

The code can be found online: https://colab.research.google.com/drive/1dMQWStzLfAHDTGuKaUNQn1aOBWeJw4FN

标签: pytorchgoogle-colaboratorytorchvision

解决方案


你检查过这个问题吗?它部分解决了问题。

之后我收到了这个错误(检测到 PyTorch 和 torchvision 是用不同的 CUDA 版本编译的。PyTorch 的 CUDA 版本=9.0,torchvision 的 CUDA 版本=10.0。请重新安装与您的 PyTorch 安装匹配的 torchvision。)并解决它

pip install torch==1.0.1 -f https://download.pytorch.org/whl/cu100/stable

我希望它有帮助:)


推荐阅读