【发布时间】:2019-04-14 22:35:25
【问题描述】:
我正在尝试使用 fastai 设置 ML 模型,并且必须执行以下导入:
import fastai.models
import fastai.nlp
import fastai.dataset
但是,fastai 导入给了我以下错误。
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fastai.nlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/fastai/nlp.py", line 172
if os.path.isdir(path): paths=glob(f'{path}/*.*')
^
SyntaxError: invalid syntax
显然,glob(f'{path}/*.*') 中的字符 f 导致了错误。我通过删除f 修复了该错误,但fastai 库中似乎有很多这些错误。
我目前的想法是我使用了不正确的 python 版本。谁能给我一些指示?
【问题讨论】:
标签: python machine-learning pytorch fast-ai