fastai-NameError:名称“TabularList”没有定义
我是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
和
fastiai incort
*
from ..basics import *
from ..callback.all import *
from .core import *
from .data import *
from .model import *
from .learner import *
I am new to pytorch and fastai. and I have been struggling to sovle few errors by googling. Now I am finally stuck. I am very frustrated. I did try fastai 2 years ago and eventually gave up, now I am trying it again and almost give up again. Can anyone help me? Thank you so much
here is the code:
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
I check the file of all.py, it is almost empty except the below import, so I think fastai might not be installed correctly? I am using
conda install -c fastai fastai
and
from fastai import *
works
from ..basics import *
from ..callback.all import *
from .core import *
from .data import *
from .model import *
from .learner import *
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在使用已弃用的 fastai 库。继续使用最新版本:fastai 文档
You are using a deprecated fastai library. Use the latest version going forward:fastai documentation