pytorch - 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
解决方案
你检查过这个问题吗?它部分解决了问题。
之后我收到了这个错误(检测到 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
我希望它有帮助:)
推荐阅读
- java - 重复提醒通知Android(java)问题
- java - Groovy + Spock 测试“Validator”类型的 void 方法,在不满足条件时抛出错误
- java - arraylist 如何在子集算法中操作和重用
- vue.js - 状态在多个应用程序之间共享。- vuex 持久化状态
- python - 使用 hvplot 从 xarray 数据集中绘制两个数据变量
- android - 过滤器正在折叠列表视图
- r - 从 R 中的 .csv 文件中删除“不可用”
- java - 如何设置临时 git-repo 进行测试?
- json - 在 Flutter 中将 JSON 解析为 Dart 对象
- simulation - Linux 上的 GROMACS 缺少 Doxygen 可执行文件