Hello
I wanted to try to upload fastai as a pypi package. So I installed fastai through setup.py
with the version that was working for me:
from setuptools import setup
setup(
name='challenge',
version='0.1.0',
description='Python package challenge',
url='https://github.com/bla/challenge',
packages=['challenge'],
install_requires=['torch',
'torchvision',
'fastai==2.1.5',
'fastcore==1.3.2'
],
)
I am running the pet breed lesson, when I run:
interp.plot_top_losses(9, figsize=(15,10))
I got the error :
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-19-be969192d4f7> in <module>
----> 1 interp.plot_top_losses(9, figsize=(15,10))
~/.virtualenvs/challenge/lib/python3.6/site-packages/fastai/interpret.py in plot_top_losses(self, k, largest, **kwargs)
38 if isinstance(self.inputs[0], Tensor): inps = tuple(o[idx] for o in self.inputs)
39 else: inps = self.dl.create_batch(self.dl.before_batch([tuple(o[i] for o in self.inputs) for i in idx]))
---> 40 b = inps + tuple(o[idx] for o in (self.targs if is_listy(self.targs) else (self.targs,)))
41 x,y,its = self.dl._pre_show_batch(b, max_n=k)
42 b_out = inps + tuple(o[idx] for o in (self.decoded if is_listy(self.decoded) else (self.decoded,)))
~/.virtualenvs/challenge/lib/python3.6/site-packages/fastai/interpret.py in <genexpr>(.0)
38 if isinstance(self.inputs[0], Tensor): inps = tuple(o[idx] for o in self.inputs)
39 else: inps = self.dl.create_batch(self.dl.before_batch([tuple(o[i] for o in self.inputs) for i in idx]))
---> 40 b = inps + tuple(o[idx] for o in (self.targs if is_listy(self.targs) else (self.targs,)))
41 x,y,its = self.dl._pre_show_batch(b, max_n=k)
42 b_out = inps + tuple(o[idx] for o in (self.decoded if is_listy(self.decoded) else (self.decoded,)))
~/.virtualenvs/challenge/lib/python3.6/site-packages/fastai/torch_core.py in __torch_function__(self, func, types, args, kwargs)
315
316 def __torch_function__(self, func, types, args=(), kwargs=None):
--> 317 with torch._C.DisableTorchFunction(): ret = _convert(func(*args, **(kwargs or {})), self.__class__)
318 if isinstance(ret, TensorBase): ret.set_meta(self, as_copy=True)
319 return ret
TypeError: only integer tensors of a single element can be converted to an index
which is odd since this worked perfectly well with my other fastai install using exactly the same data and code. Anyone has this problem before?