AttributeError when importing fastxtend.vision.all
manningkyle304 opened this issue · comments
I'm encountering the following when trying to import fastextend: AttributeError: 'function' object has no attribute '__base__'
Steps to reproduce: Installed fastai, ran pip install fastxtend[vision]
, then tried to import in my jupyter notebook.
- OS: Ubuntu 20.04.6
- fastxtend version: fastxtend-0.1.6
- Python version: Python 3.8.10
- fastcore version: fastcore-1.5.29
- fastai version: fastai-2.7.13
Traceback:
from fastxtend.vision.all import *
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[17], line 1
----> 1 from fastxtend.vision.all import *
File /usr/local/lib/python3.8/dist-packages/fastxtend/vision/all.py:2
1 from ..basics import *
----> 2 from ..callback.all import *
3 from .data import *
4 from ..data.all import *
File /usr/local/lib/python3.8/dist-packages/fastxtend/callback/all.py:9
6 from .channelslast import *
8 from .cutmixup import *
----> 9 from .ema import *
10 from .lr_finder import *
11 from .progresize import *
File /usr/local/lib/python3.8/dist-packages/fastxtend/callback/ema.py:18
15 from fastai.callback.fp16 import MixedPrecision
16 from fastai.callback.schedule import SchedCos, _Annealer
---> 18 from .utils import *
19 from ..imports import *
21 # %% auto 0
File /usr/local/lib/python3.8/dist-packages/fastxtend/callback/utils.py:38
32 available_loggers = {
33 'wandb': WANDB,
34 'tensorboard': TENSORBOARD
35 }
37 # %% ../../nbs/callback.utils.ipynb 7
---> 38 class LogDispatch(Callback):
39 "A default callback for dispatching additional values to loggers"
40 run_valid, order = False, Recorder.order+2
File /usr/local/lib/python3.8/dist-packages/fastxtend/callback/utils.py:66, in LogDispatch()
62 for log in self.loggers:
63 log(self.valid_values)
65 @delegates(wandb.Table if WANDB else None)
---> 66 def log_wandb_table(self, name:str, **kwargs):
67 "Log `wandb.Table` to Weights and Biases. See `wandb.Table` for details"
68 if WANDB:
File /usr/local/lib/python3.8/dist-packages/fastcore/meta.py:115, in delegates.<locals>._f(f)
114 def _f(f):
--> 115 if to is None: to_f,from_f = f.__base__.__init__,f.__init__
116 else: to_f,from_f = to.__init__ if isinstance(to,type) else to,f
117 from_f = getattr(from_f,'__func__',from_f)
AttributeError: 'function' object has no attribute '__base__'
@manningkyle304 Thanks for the detailed issue. #20 should resolve this issue.
In the meantime, installing Weights and Biases will prevent the error.
pip install wandb
As it is not apparent from the error, fastxtend is meant to be imported after fastai:
from fastai.vision.all import *
from fastxtend.vision.all import *
If you are already doing this, feel free to ignore.