【发布时间】:2022-10-24 01:28:36
【问题描述】:
我是 pytorch 和 fastai 的新手。我一直在努力通过谷歌搜索来解决一些错误。现在我终于被困住了。我很沮丧。我在 2 年前尝试过 fastai,最终放弃了,现在我再次尝试,几乎再次放弃。谁能帮我?太感谢了
这是代码:
import fastai
fastai.__version__
'2.5.6'
from fastai import *
from fastai.tabular.all import *
data = (TabularList.from_df(df,
cat_names=cat_features,
cont_names=num_features,
procs=preprocessing)
.split_by_rand_pct(valid_pct=0.2, seed=42)
.label_from_df(cols=DEP_VAR)
.databunch())
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [31], in <cell line: 1>()
----> 1 data = (TabularList.from_df(df,
2 cat_names=cat_features,
3 cont_names=num_features,
4 procs=preprocessing)
5 .split_by_rand_pct(valid_pct=0.2, seed=42)
6 .label_from_df(cols=DEP_VAR)
7 .databunch())
NameError: name 'TabularList' is not defined
我检查了 all.py 的文件,除了下面的导入,它几乎是空的,所以我认为 fastai 可能没有正确安装?我在用
conda install -c fastai fastai
和
从 fastai 进口 *
作品
from ..basics import *
from ..callback.all import *
from .core import *
from .data import *
from .model import *
from .learner import *
【问题讨论】: