I just updated fastai
today and I’m getting some goofy errors while trying to duplicate results in the documentation (I’m just running examples at the moment).
My current install:
=== Software ===
python version : 3.7.0
fastai version : 1.0.35.dev0
torch version : 1.0.0.dev20181022
nvidia driver : 396.54
torch cuda ver : 9.2.148
torch cuda is : available
torch cudnn ver : 7104
torch cudnn is : enabled
=== Hardware ===
nvidia gpus : 1
torch available : 1
- gpu0 : 11441MB | Tesla K80
=== Environment ===
platform : Linux-4.15.0-1025-gcp-x86_64-with-debian-buster-sid
distro : Ubuntu 18.04 Bionic Beaver
conda env : Unknown
python : /home/beehollander/anaconda3/envs/fastai-v1/bin/python
sys.path :
/home/beehollander/fastai/examples
/home/beehollander/anaconda3/envs/fastai-v1/lib/python37.zip
/home/beehollander/anaconda3/envs/fastai-v1/lib/python3.7
/home/beehollander/anaconda3/envs/fastai-v1/lib/python3.7/lib-dynload
/home/beehollander/anaconda3/envs/fastai-v1/lib/python3.7/site-packages
/home/beehollander/fastai
/home/beehollander/anaconda3/envs/fastai-v1/lib/python3.7/site-packages/IPython/extensions
/home/beehollander/.ipython
Fri Dec 7 18:36:03 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.54 Driver Version: 396.54 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla K80 Off | 00000000:00:04.0 Off | 0 |
| N/A 72C P0 76W / 149W | 302MiB / 11441MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 3754 C ...der/anaconda3/envs/fastai-v1/bin/python 291MiB |
+-----------------------------------------------------------------------------+
In the tabular example, when it tries to run learn.fit
it gives me this error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-12-c6076a6ce3f3> in <module>
----> 1 learn.fit(1, 1e-2)
~/fastai/fastai/basic_train.py in fit(self, epochs, lr, wd, callbacks)
164 callbacks = [cb(self) for cb in self.callback_fns] + listify(callbacks)
165 fit(epochs, self.model, self.loss_func, opt=self.opt, data=self.data, metrics=self.metrics,
--> 166 callbacks=self.callbacks+callbacks)
167
168 def create_opt(self, lr:Floats, wd:Floats=0.)->None:
~/fastai/fastai/basic_train.py in fit(epochs, model, loss_func, opt, data, callbacks, metrics)
72 cb_handler = CallbackHandler(callbacks, metrics)
73 pbar = master_bar(range(epochs))
---> 74 cb_handler.on_train_begin(epochs, pbar=pbar, metrics=metrics)
75
76 exception=False
~/fastai/fastai/callback.py in on_train_begin(self, epochs, pbar, metrics)
193 self.state_dict['n_epochs'],self.state_dict['pbar'],self.state_dict['metrics'] = epochs,pbar,metrics
194 names = [(met.name if hasattr(met, 'name') else camel2snake(met.__class__.__name__)) for met in self.metrics]
--> 195 self('train_begin', metrics_names=names)
196
197 def on_epoch_begin(self)->None:
~/fastai/fastai/callback.py in __call__(self, cb_name, call_mets, **kwargs)
186 "Call through to all of the `CallbakHandler` functions."
187 if call_mets: [getattr(met, f'on_{cb_name}')(**self.state_dict, **kwargs) for met in self.metrics]
--> 188 return [getattr(cb, f'on_{cb_name}')(**self.state_dict, **kwargs) for cb in self.callbacks]
189
190 def on_train_begin(self, epochs:int, pbar:PBar, metrics:MetricFuncList)->None:
~/fastai/fastai/callback.py in <listcomp>(.0)
186 "Call through to all of the `CallbakHandler` functions."
187 if call_mets: [getattr(met, f'on_{cb_name}')(**self.state_dict, **kwargs) for met in self.metrics]
--> 188 return [getattr(cb, f'on_{cb_name}')(**self.state_dict, **kwargs) for cb in self.callbacks]
189
190 def on_train_begin(self, epochs:int, pbar:PBar, metrics:MetricFuncList)->None:
~/fastai/fastai/basic_train.py in on_train_begin(self, pbar, metrics_names, **kwargs)
329 self.names += metrics_names
330 if hasattr(self, '_added_met_names'): self.names += self._added_met_names
--> 331 self.pbar.write(self.names, table=True)
332 self.losses,self.val_losses,self.lrs,self.moms,self.metrics,self.nb_batches = [],[],[],[],[],[]
333
~/anaconda3/envs/fastai-v1/lib/python3.7/site-packages/fastprogress/fastprogress.py in write(self, line, table)
223 if not table: self.text += line + "<p>"
224 else:
--> 225 self.raw_text += line + "\n"
226 self.text = text2html_table(self.raw_text)
227
TypeError: can only concatenate list (not "str") to list
And then in the dogs_cats example, it gives me this error when it tries to run img.show(title=data.classes[label])
:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-7-e4a591a007cd> in <module>
----> 1 img.show(title=data.classes[label])
TypeError: list indices must be integers or slices, not Category
The reason for the Category
error is probably because label
is defined above it by:
img,label = data.valid_ds[-1]
and so that’s returning a Category and not an index like this code was written for.
Did I miss something? It feels like there was some change that I didn’t hear about and now so much has changed even since the last lesson. Are things simply changing so often that there’s month-old code that’s stale now? The cats_dogs
notebook was updated 28 days ago and the tabular
one less than that. I don’t want to tell anybody to slow down, but there seems to be so much change that it’s hard to hang on to what WON’T change.