fastai-NameError:名称“TabularList”没有定义

发布于 2025-01-20 06:29:03 字数 1513 浏览 3 评论 0原文

我是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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风向决定发型 2025-01-27 06:29:03

您正在使用已弃用的 fastai 库。继续使用最新版本:fastai 文档

You are using a deprecated fastai library. Use the latest version going forward:fastai documentation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文