fast.ai(零)windows + pytorch 0.4

一、下载

git clone https://github.com/fastai/fastai.git

或者直接下载下来

二、安装pytorch

去官网安装建议安装即可

https://pytorch.org

如果下载失败,去这里

https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/

三、解决错误

教程中有import fastai 模块,不需要pip安装,源码中提供了,把 fastai 文件夹加入到路径下即可:

import sys
sys.path.append('E:/fastai')

以 course/lesson1.ipynb 为例,cmd下运行

jupyter notebook E:\fastai

打开course/lesson1.ipynb,添加路径运行(粉色是加入你的fastai路径)

# Put these at the top of every notebook, to get automatic reloading and inline plotting
%reload_ext autoreload
%autoreload 2
%matplotlib inline
import sys
sys.path.append('E:/fastai')

然后往下运行,会出现各种库缺失,不要怕,缺啥pip安装就是了(下面是个例子)

No module named 'bcolz' -> pip install bcolz
No module named 'graphviz' -> pip install graphviz
No module named 'sklearn_pandas' -> pip install sklearn_pandas
No module named 'isoweek' -> pip install isoweek
No module named 'pandas_summary' -> pip install pandas_summary
No module named 'tqdm' -> pip install tqdm
No module named 'torchtext' -> pip install torchtext

然后运行 from fastai.transforms import * 还是会报错,解决方案参考这里

cd courses\dl1
del fastai
mklink /d fastai ..\..\old\fastai
cd ..\..

然后代码里涉及到路径的地方换成绝对路径就好了

    原文作者:pytorch
    原文地址: https://www.cnblogs.com/xuanyuyt/p/9858370.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞