Fast_tabnet import issue NameError: name 'log_args' is not defined

Hey all,

Trying to following along with @muellerzr lectures on TabNet and I’m having issues importing it. I attempted the solutions mentioned in posts such as “NameError: name 'log_args' is not defined · Issue #270 · fastai/fastai2 · GitHub”, and have the 1.3.20 version of fasctore, and I installed fastai2 as well (which my understanding is it’s no longer supported after it was moved to fastai v2), but I’m still getting this error.

For anyone curious, you can find his lectures here: A walk with fastai2 - Vision - Study Group and Online Lectures Megathread

However, the error I’m getting for TabNet is found as follows


NameError Traceback (most recent call last)
in
4 ######################################################
5 “”"
----> 6 from fast_tabnet.core import *
7 from fast_tabnet.core import TabNetNoEmbeddings

~\anaconda3\envs\Qnetworks\lib\site-packages\fast_tabnet\core.py in
4
5 # Cell
----> 6 from fastai2.basics import *
7 from fastai2.tabular.all import *
8 from pytorch_tabnet.tab_network import TabNetNoEmbeddings

~\anaconda3\envs\Qnetworks\lib\site-packages\fastai2\basics.py in
----> 1 from .data.all import *
2 from .optimizer import *
3 from .callback.core import *
4 from .learner import *
5 from .metrics import *

~\anaconda3\envs\Qnetworks\lib\site-packages\fastai2\data\all.py in
----> 1 from …torch_basics import *
2 from .core import *
3 from .load import *
4 from .external import *
5 from .transforms import *

~\anaconda3\envs\Qnetworks\lib\site-packages\fastai2\torch_basics.py in
3 from .torch_imports import *
4 from .torch_core import *
----> 5 from .layers import *

~\anaconda3\envs\Qnetworks\lib\site-packages\fastai2\layers.py in
274
275 # Cell
→ 276 @log_args
277 class BaseLoss():
278 “Same as loss_cls, but flattens input and target.”

NameError: name ‘log_args’ is not defined

1 Like

Have you tried running it based on the actual course notebook/website? I verified all notebooks worked before I posted them:

(If there’s still issues do let me know!)

2 Likes

Oh man so this is going to be super unhelpful for most people but the SHORT of it (because I lost track of all the ways I tried getting this to work) was combinations of conda installs and pip installs to get to
FastAI version 2.1.10
Fastcore: 1.1.13
Fastdot: 0.1.3
WWF: 0.0.2
fast_tabnet: 0.2.0
pytorch_tabnet - Not sure which version as it doesn’t appear to have a .version property

Either way I was able to get the imports working finally. It seems I’m always struggling with keeping the dependencies from breaking each other when attempting to use FastAI libraries with the other more standard ones, and it is 99% user error. I do try my best to use conda install as opposed to pip, but often it is unable to solve the environments or find the repos when it comes to FastAI packages.

Either way, I’ll try my best to stick with these versions, as getting this to work somehow broke my main development conda environment.

Thanks again as always, Zach. I’m gonna have to donate some coffee too you should you ever decide to setup a donations link!

1 Like