Error that wasnt happening yesterday, L1, index

Good day,
yesterday I executed most of Lesson 1 notebook on Google Collab all well with no issues,
today I’m getting this error right at the beginning when running the model:

invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number,

any tips? thank you


/usr/local/lib/python3.6/dist-packages/fastai/initializers.py:6: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaiming_normal_.
if hasattr(m, ‘weight’): init_fn(m.weight)
HBox(children=(IntProgress(value=0, description=‘Epoch’, max=2, style=ProgressStyle(description_width='initial…
0%| | 0/360 [00:00<?, ?it/s]

IndexError Traceback (most recent call last)
in ()
2 data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
3 learn = ConvLearner.pretrained(arch, data, precompute=True)
----> 4 learn.fit(0.01, 2)

/usr/local/lib/python3.6/dist-packages/fastai/learner.py in fit(self, lrs, n_cycle, wds, **kwargs)
97 self.sched = None
98 layer_opt = self.get_layer_opt(lrs, wds)
—> 99 self.fit_gen(self.model, self.data, layer_opt, n_cycle, **kwargs)
100
101 def lr_find(self, start_lr=1e-5, end_lr=10, wds=None):

/usr/local/lib/python3.6/dist-packages/fastai/learner.py in fit_gen(self, model, data, layer_opt, n_cycle, cycle_len, cycle_mult, cycle_save_name, metrics, callbacks, **kwargs)
87 n_epoch = sum_geom(cycle_len if cycle_len else 1, cycle_mult, n_cycle)
88 fit(model, data, n_epoch, layer_opt.opt, self.crit,
—> 89 metrics=metrics, callbacks=callbacks, reg_fn=self.reg_fn, clip=self.clip, **kwargs)
90
91 def get_layer_groups(self): return self.models.get_layer_groups()

/usr/local/lib/python3.6/dist-packages/fastai/model.py in fit(model, data, epochs, opt, crit, metrics, callbacks, kwargs)
82 for (*x,y) in t:
83 batch_num += 1
—> 84 loss = stepper.step(V(x),V(y))
85 avg_loss = avg_loss * avg_mom + loss * (1-avg_mom)
86 debias_loss = avg_loss / (1 - avg_mom
batch_num)

/usr/local/lib/python3.6/dist-packages/fastai/model.py in step(self, xs, y)
47 nn.utils.clip_grad_norm(trainable_params_(self.m), self.clip)
48 self.opt.step()
—> 49 return raw_loss.data[0]
50
51 def evaluate(self, xs, y):

IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

I keep getting this error in google colab:

IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

any help please? yesterday it was all working well, now I just keep getting this error, thank you

I will try it shortly and see if I have the same issue. I know Google cloud storage is having issues today.

Thank you again Allan :wink: I sent you a longer reply on the other thread, I copy it here below just in case you don’t look at the other one :slight_smile:
:wink:

Hi Allan, and thank you very much, you are all very helpful :slight_smile:
so i finally made it work but doing something really weird, doing this

a) !pip install http://download.pytorch.org/whl/cu80/torch-0.3.0.post4-cp36-cp36m-linux_x86_64.whl && pip install torchvision

b) !pip install fastai

c) !apt update && apt install -y libsm6 libxext6

at this point I get some errors and then I do

d) !pip3 install torch torchvision fastai==0.6

e) restart runtime

and then it all works fine!

but I cannot do d) without doing a) b) c) , then it doesnt work,
for it to work I have to literally do a) b) and d) as you see there in that order

im sure this is not ideal, but it works, so far :wink:

so the notebooks Im using at the moment are the ones I downloaded from the fastai master github repo, are those the old ones?
Im following the videos here
https://course.fast.ai/lessons/lesson3.html
Im in 3 so far

so are you saying that from january 2019 there will be brand new notebooks and brand new videos? great, and when will those be active and when and where can we find them online? excited for that

so with the new notebooks it will be enough to do this
course-v3.fast.ai/start_colab.html
and it will work like that?

thank you again, by the away im doing this on my own so far but I would love to join a group, Im based in Barcelona, Spain, btw I know some of you are from bay area, I lived in Silicon Valley for 6 years, San Francisco and Palo Alto, was involved in a few startups, returned to Europe 3 years ago or so, so yeah would love to get involved with more people and a group if I find one around, so till then I started on my own, I did the 3 first complete courses of the Andrew coursera deep learning specialization, and the last 2 I did the videos of it and then I found fast.ai and instantly I loved it so now Im going all in with fast.ai :wink:

Great, now I downloaded the new notebooks at:

and then did
https://course-v3.fast.ai/start_colab.html

and so far its working :wink:

and where will the new videos be? will they replace the current ones in January?

and any suggestions to join a group somewhere?

thank u :wink: