Index 3 is out of bounds for dimension 0 with size 3

Not sure why I got this error.

index 3 is out of bounds for dimension 0 with size 3

epoch train_loss valid_loss error_rate time
0 0.721268 00:10
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
in
1 learn = cnn_learner(dlsaug, resnet18, metrics=error_rate)
----> 2 learn.fine_tune(1)

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/callback/schedule.py in fine_tune(self, epochs, base_lr, freeze_epochs, lr_mult, pct_start, div, **kwargs)
    155     "Fine tune with `freeze` for `freeze_epochs` then with `unfreeze` from `epochs` using discriminative LR"
    156     self.freeze()
--> 157     self.fit_one_cycle(freeze_epochs, slice(base_lr), pct_start=0.99, **kwargs)
    158     base_lr /= 2
    159     self.unfreeze()

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/callback/schedule.py in fit_one_cycle(self, n_epoch, lr_max, div, div_final, pct_start, wd, moms, cbs, reset_opt)
    110     scheds = {'lr': combined_cos(pct_start, lr_max/div, lr_max, lr_max/div_final),
    111               'mom': combined_cos(pct_start, *(self.moms if moms is None else moms))}
--> 112     self.fit(n_epoch, cbs=ParamScheduler(scheds)+L(cbs), reset_opt=reset_opt, wd=wd)
    113 
    114 # Cell

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/learner.py in fit(self, n_epoch, lr, wd, cbs, reset_opt)
    193                     try:
    194                         self.epoch=epoch;          self('begin_epoch')
--> 195                         self._do_epoch_train()
    196                         self._do_epoch_validate()
    197                     except CancelEpochException:   self('after_cancel_epoch')

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/learner.py in _do_epoch_train(self)
    166         try:
    167             self.dl = self.dls.train;                        self('begin_train')
--> 168             self.all_batches()
    169         except CancelTrainException:                         self('after_cancel_train')
    170         finally:                                             self('after_train')

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/learner.py in all_batches(self)
    144     def all_batches(self):
    145         self.n_iter = len(self.dl)
--> 146         for o in enumerate(self.dl): self.one_batch(*o)
    147 
    148     def one_batch(self, i, b):

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/learner.py in one_batch(self, i, b)
    149         self.iter = i
    150         try:
--> 151             self._split(b);                                  self('begin_batch')
    152             self.pred = self.model(*self.xb);                self('after_pred')
    153             if len(self.yb) == 0: return

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/learner.py in __call__(self, event_name)
    125     def ordered_cbs(self, event): return [cb for cb in sort_by_run(self.cbs) if hasattr(cb, event)]
    126 
--> 127     def __call__(self, event_name): L(event_name).map(self._call_one)
    128     def _call_one(self, event_name):
    129         assert hasattr(event, event_name)

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastcore/foundation.py in map(self, f, *args, **kwargs)
    370              else f.format if isinstance(f,str)
    371              else f.__getitem__)
--> 372         return self._new(map(g, self))
    373 
    374     def filter(self, f, negate=False, **kwargs):

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastcore/foundation.py in _new(self, items, *args, **kwargs)
    321     @property
    322     def _xtra(self): return None
--> 323     def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
    324     def __getitem__(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
    325     def copy(self): return self._new(self.items.copy())

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastcore/foundation.py in __call__(cls, x, *args, **kwargs)
     39             return x
     40 
---> 41         res = super().__call__(*((x,) + args), **kwargs)
     42         res._newchk = 0
     43         return res

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastcore/foundation.py in __init__(self, items, use_list, match, *rest)
    312         if items is None: items = []
    313         if (use_list is not None) or not _is_array(items):
--> 314             items = list(items) if use_list else _listify(items)
    315         if match is not None:
    316             if is_coll(match): match = len(match)

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastcore/foundation.py in _listify(o)
    248     if isinstance(o, list): return o
    249     if isinstance(o, str) or _is_array(o): return [o]
--> 250     if is_iter(o): return list(o)
    251     return [o]
    252 

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastcore/foundation.py in __call__(self, *args, **kwargs)
    214             if isinstance(v,_Arg): kwargs[k] = args.pop(v.i)
    215         fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:]
--> 216         return self.fn(*fargs, **kwargs)
    217 
    218 # Cell

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/learner.py in _call_one(self, event_name)
    128     def _call_one(self, event_name):
    129         assert hasattr(event, event_name)
--> 130         [cb(event_name) for cb in sort_by_run(self.cbs)]
    131 
    132     def _bn_bias_state(self, with_bias): return bn_bias_params(self.model, with_bias).map(self.opt.state)

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/learner.py in <listcomp>(.0)
    128     def _call_one(self, event_name):
    129         assert hasattr(event, event_name)
--> 130         [cb(event_name) for cb in sort_by_run(self.cbs)]
    131 
    132     def _bn_bias_state(self, with_bias): return bn_bias_params(self.model, with_bias).map(self.opt.state)

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/callback/core.py in __call__(self, event_name)
     22         _run = (event_name not in _inner_loop or (self.run_train and getattr(self, 'training', True)) or
     23                (self.run_valid and not getattr(self, 'training', False)))
---> 24         if self.run and _run: getattr(self, event_name, noop)()
     25         if event_name=='after_fit': self.run=True #Reset self.run to True at each end of fit
     26 

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/callback/schedule.py in begin_batch(self)
     84     def __init__(self, scheds): self.scheds = scheds
     85     def begin_fit(self): self.hps = {p:[] for p in self.scheds.keys()}
---> 86     def begin_batch(self): self._update_val(self.pct_train)
     87 
     88     def _update_val(self, pct):

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/callback/schedule.py in _update_val(self, pct)
     87 
     88     def _update_val(self, pct):
---> 89         for n,f in self.scheds.items(): self.opt.set_hyper(n, f(pct))
     90 
     91     def after_batch(self):

/opt/conda/envs/fastai/lib/python3.7/site-packages/fastai2/callback/schedule.py in _inner(pos)
     67         if pos == 1.: return scheds[-1](1.)
     68         idx = (pos >= pcts).nonzero().max()
---> 69         actual_pos = (pos-pcts[idx]) / (pcts[idx+1]-pcts[idx])
     70         return scheds[idx](actual_pos.item())
     71     return _inner

It works when I use the pure DataBlock
but not after I create the .new one

solidsaug = solids.new(item_tfms=Resize(128), batch_tfms=aug_transforms())

I am having a similar issue.
I have a data set of images in train and valid folders, with digits from 0 to 9 as subfolders. Those contain .pngs with individual digits.

from fastai.vision.all import *
from fastai import test_utils
from fastai.vision import models

tfms = aug_transforms(do_flip=False)
data = ImageDataLoaders.from_folder(’/dbfs/mnt/covis/images/generated_images’,ds_tfms=tfms)

learn = cnn_learner(data, models.resnet34)
learn.fit_one_cycle(1)

This produces


IndexError Traceback (most recent call last)
in
3 # learn = cnn_learner(data, resnet34, metrics=error_rate)
4 # learn = test_utils.synth_learner(lr=5e-2)
----> 5 learn.fit_one_cycle(1)
6 # learn.model_dir = “/dbfs/mnt/covis/models/”
7 # learn.load(‘stage-3’)

/databricks/python/lib/python3.7/site-packages/fastcore/utils.py in _f(*args, **kwargs)
452 init_args.update(log)
453 setattr(inst, ‘init_args’, init_args)
–> 454 return inst if to_return else f(*args, **kwargs)
455 return _f
456

/databricks/python/lib/python3.7/site-packages/fastai/callback/schedule.py in fit_one_cycle(self, n_epoch, lr_max, div, div_final, pct_start, wd, moms, cbs, reset_opt)
111 scheds = {‘lr’: combined_cos(pct_start, lr_max/div, lr_max, lr_max/div_final),
112 ‘mom’: combined_cos(pct_start, *(self.moms if moms is None else moms))}
–> 113 self.fit(n_epoch, cbs=ParamScheduler(scheds)+L(cbs), reset_opt=reset_opt, wd=wd)
114
115 # Cell

/databricks/python/lib/python3.7/site-packages/fastcore/utils.py in _f(*args, **kwargs)
452 init_args.update(log)
453 setattr(inst, ‘init_args’, init_args)
–> 454 return inst if to_return else f(*args, **kwargs)
455 return _f
456

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in fit(self, n_epoch, lr, wd, cbs, reset_opt)
205 self.opt.set_hypers(lr=self.lr if lr is None else lr)
206 self.n_epoch,self.loss = n_epoch,tensor(0.)
–> 207 self._with_events(self._do_fit, ‘fit’, CancelFitException, self._end_cleanup)
208
209 def _end_cleanup(self): self.dl,self.xb,self.yb,self.pred,self.loss = None,(None,),(None,),None,None

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
–> 155 try: self(f’before
{event_type}’) ;f()
156 except ex: self(f’after_cancel
{event_type}’)
157 finally: self(f’after_{event_type}’) ;final()

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in _do_fit(self)
195 for epoch in range(self.n_epoch):
196 self.epoch=epoch
–> 197 self._with_events(self._do_epoch, ‘epoch’, CancelEpochException)
198
199 @log_args(but=‘cbs’)

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
–> 155 try: self(f’before
{event_type}’) ;f()
156 except ex: self(f’after_cancel
{event_type}’)
157 finally: self(f’after_{event_type}’) ;final()

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in _do_epoch(self)
189
190 def _do_epoch(self):
–> 191 self._do_epoch_train()
192 self._do_epoch_validate()
193

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in _do_epoch_train(self)
181 def _do_epoch_train(self):
182 self.dl = self.dls.train
–> 183 self._with_events(self.all_batches, ‘train’, CancelTrainException)
184
185 def _do_epoch_validate(self, ds_idx=1, dl=None):

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
–> 155 try: self(f’before
{event_type}’) ;f()
156 except ex: self(f’after_cancel
{event_type}’)
157 finally: self(f’after_{event_type}’) ;final()

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in all_batches(self)
159 def all_batches(self):
160 self.n_iter = len(self.dl)
–> 161 for o in enumerate(self.dl): self.one_batch(*o)
162
163 def _do_one_batch(self):

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in one_batch(self, i, b)
177 self.iter = i
178 self._split(b)
–> 179 self._with_events(self._do_one_batch, ‘batch’, CancelBatchException)
180
181 def _do_epoch_train(self):

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
–> 155 try: self(f’before
{event_type}’) ;f()
156 except ex: self(f’after_cancel
{event_type}’)
157 finally: self(f’after_{event_type}’) ;final()

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in call(self, event_name)
131 def ordered_cbs(self, event): return [cb for cb in sort_by_run(self.cbs) if hasattr(cb, event)]
132
–> 133 def call(self, event_name): L(event_name).map(self._call_one)
134
135 def _call_one(self, event_name):

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in map(self, f, *args, **kwargs)
381 else f.format if isinstance(f,str)
382 else f.getitem)
–> 383 return self._new(map(g, self))
384
385 def filter(self, f, negate=False, **kwargs):

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in _new(self, items, *args, **kwargs)
331 @property
332 def _xtra(self): return None
–> 333 def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
334 def getitem(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
335 def copy(self): return self._new(self.items.copy())

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in call(cls, x, args, **kwargs)
45 return x
46
—> 47 res = super().call(
((x,) + args), **kwargs)
48 res._newchk = 0
49 return res

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in init(self, items, use_list, match, *rest)
322 if items is None: items = []
323 if (use_list is not None) or not _is_array(items):
–> 324 items = list(items) if use_list else _listify(items)
325 if match is not None:
326 if is_coll(match): match = len(match)

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in _listify(o)
258 if isinstance(o, list): return o
259 if isinstance(o, str) or _is_array(o): return [o]
–> 260 if is_iter(o): return list(o)
261 return [o]
262

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in call(self, *args, **kwargs)
224 if isinstance(v,_Arg): kwargs[k] = args.pop(v.i)
225 fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:]
–> 226 return self.fn(*fargs, **kwargs)
227
228 # Cell

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in _call_one(self, event_name)
135 def _call_one(self, event_name):
136 assert hasattr(event, event_name), event_name
–> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
139 def _bn_bias_state(self, with_bias): return norm_bias_params(self.model, with_bias).map(self.opt.state)

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in (.0)
135 def _call_one(self, event_name):
136 assert hasattr(event, event_name), event_name
–> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
139 def _bn_bias_state(self, with_bias): return norm_bias_params(self.model, with_bias).map(self.opt.state)

/databricks/python/lib/python3.7/site-packages/fastai/callback/core.py in call(self, event_name)
42 (self.run_valid and not getattr(self, ‘training’, False)))
43 res = None
—> 44 if self.run and _run: res = getattr(self, event_name, noop)()
45 if event_name==‘after_fit’: self.run=True #Reset self.run to True at each end of fit
46 return res

/databricks/python/lib/python3.7/site-packages/fastai/callback/schedule.py in before_batch(self)
84 def init(self, scheds): self.scheds = scheds
85 def before_fit(self): self.hps = {p:[] for p in self.scheds.keys()}
—> 86 def before_batch(self): self._update_val(self.pct_train)
87
88 def _update_val(self, pct):

/databricks/python/lib/python3.7/site-packages/fastai/callback/schedule.py in _update_val(self, pct)
87
88 def _update_val(self, pct):
—> 89 for n,f in self.scheds.items(): self.opt.set_hyper(n, f(pct))
90
91 def after_batch(self):

/databricks/python/lib/python3.7/site-packages/fastai/callback/schedule.py in _inner(pos)
67 if pos == 1.: return scheds-1
68 idx = (pos >= pcts).nonzero().max()
—> 69 actual_pos = (pos-pcts[idx]) / (pcts[idx+1]-pcts[idx])
70 return schedsidx
71 return _inner

IndexError: index 3 is out of bounds for dimension 0 with size 3

I currently have no clue as to what I am doing wrong. I have tried the same task with the synth_learner and it works. Since I am fairly new to fastai I would really appreciate some help.

Hi @tokleine I am facing the same issue in training my text classifier. Were you able to solve it?
I am also on databricks and getting the same error as you are:

My code:

import fastai`
from fastai.text.all import *
dls_clas = TextDataLoaders.from_df(df1, path=path, text_col=‘Improve text’, label_col=‘sentiment’, valid_pct=0.2, text_vocab=dls_lm.vocab, bs=32)
learn = text_classifier_learner(dls_clas, AWD_LSTM, drop_mult=0.5, metrics=accuracy)
learn.load_encoder(‘fine_tuned_enc_whole’)
learn.lr_find()
image

learn.fit_one_cycle(1, 10e-2)


IndexError Traceback (most recent call last)
in
1 #learn.fit_one_cycle(1, 5e-3, moms=(0.8,0.7))
----> 2 learn.fit_one_cycle(1, 10e-2)

/databricks/python/lib/python3.7/site-packages/fastcore/utils.py in _f(*args, **kwargs)
471 init_args.update(log)
472 setattr(inst, ‘init_args’, init_args)
–> 473 return inst if to_return else f(*args, **kwargs)
474 return _f
475

/databricks/python/lib/python3.7/site-packages/fastai/callback/schedule.py in fit_one_cycle(self, n_epoch, lr_max, div, div_final, pct_start, wd, moms, cbs, reset_opt)
111 scheds = {‘lr’: combined_cos(pct_start, lr_max/div, lr_max, lr_max/div_final),
112 ‘mom’: combined_cos(pct_start, *(self.moms if moms is None else moms))}
–> 113 self.fit(n_epoch, cbs=ParamScheduler(scheds)+L(cbs), reset_opt=reset_opt, wd=wd)
114
115 # Cell

/databricks/python/lib/python3.7/site-packages/fastcore/utils.py in _f(*args, **kwargs)
471 init_args.update(log)
472 setattr(inst, ‘init_args’, init_args)
–> 473 return inst if to_return else f(*args, **kwargs)
474 return _f
475

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in fit(self, n_epoch, lr, wd, cbs, reset_opt)
205 self.opt.set_hypers(lr=self.lr if lr is None else lr)
206 self.n_epoch,self.loss = n_epoch,tensor(0.)
–> 207 self._with_events(self._do_fit, ‘fit’, CancelFitException, self._end_cleanup)
208
209 def _end_cleanup(self): self.dl,self.xb,self.yb,self.pred,self.loss = None,(None,),(None,),None,None

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
–> 155 try: self(f’before
{event_type}’) ;f()
156 except ex: self(f’after_cancel
{event_type}’)
157 finally: self(f’after_{event_type}’) ;final()

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in _do_fit(self)
195 for epoch in range(self.n_epoch):
196 self.epoch=epoch
–> 197 self._with_events(self._do_epoch, ‘epoch’, CancelEpochException)
198
199 @log_args(but=‘cbs’)

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
–> 155 try: self(f’before
{event_type}’) ;f()
156 except ex: self(f’after_cancel
{event_type}’)
157 finally: self(f’after_{event_type}’) ;final()

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in _do_epoch(self)
189
190 def _do_epoch(self):
–> 191 self._do_epoch_train()
192 self._do_epoch_validate()
193

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in _do_epoch_train(self)
181 def _do_epoch_train(self):
182 self.dl = self.dls.train
–> 183 self._with_events(self.all_batches, ‘train’, CancelTrainException)
184
185 def _do_epoch_validate(self, ds_idx=1, dl=None):

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
–> 155 try: self(f’before
{event_type}’) ;f()
156 except ex: self(f’after_cancel
{event_type}’)
157 finally: self(f’after_{event_type}’) ;final()

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in all_batches(self)
159 def all_batches(self):
160 self.n_iter = len(self.dl)
–> 161 for o in enumerate(self.dl): self.one_batch(*o)
162
163 def _do_one_batch(self):

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in one_batch(self, i, b)
177 self.iter = i
178 self._split(b)
–> 179 self._with_events(self._do_one_batch, ‘batch’, CancelBatchException)
180
181 def _do_epoch_train(self):

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in with_events(self, f, event_type, ex, final)
153
154 def with_events(self, f, event_type, ex, final=noop):
–> 155 try: self(f’before
{event_type}’) ;f()
156 except ex: self(f’after_cancel
{event_type}’)
157 finally: self(f’after_{event_type}’) ;final()

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in call(self, event_name)
131 def ordered_cbs(self, event): return [cb for cb in sort_by_run(self.cbs) if hasattr(cb, event)]
132
–> 133 def call(self, event_name): L(event_name).map(self._call_one)
134
135 def _call_one(self, event_name):

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in map(self, f, *args, **kwargs)
394 else f.format if isinstance(f,str)
395 else f.getitem)
–> 396 return self._new(map(g, self))
397
398 def filter(self, f, negate=False, **kwargs):

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in _new(self, items, *args, **kwargs)
340 @property
341 def _xtra(self): return None
–> 342 def _new(self, items, *args, **kwargs): return type(self)(items, *args, use_list=None, **kwargs)
343 def getitem(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
344 def copy(self): return self._new(self.items.copy())

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in call(cls, x, args, **kwargs)
49 return x
50
—> 51 res = super().call(
((x,) + args), **kwargs)
52 res._newchk = 0
53 return res

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in init(self, items, use_list, match, *rest)
331 if items is None: items = []
332 if (use_list is not None) or not _is_array(items):
–> 333 items = list(items) if use_list else _listify(items)
334 if match is not None:
335 if is_coll(match): match = len(match)

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in _listify(o)
244 if isinstance(o, list): return o
245 if isinstance(o, str) or _is_array(o): return [o]
–> 246 if is_iter(o): return list(o)
247 return [o]
248

/databricks/python/lib/python3.7/site-packages/fastcore/foundation.py in call(self, *args, **kwargs)
307 if isinstance(v,_Arg): kwargs[k] = args.pop(v.i)
308 fargs = [args[x.i] if isinstance(x, _Arg) else x for x in self.pargs] + args[self.maxi+1:]
–> 309 return self.fn(*fargs, **kwargs)
310
311 # Cell

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in _call_one(self, event_name)
135 def _call_one(self, event_name):
136 assert hasattr(event, event_name), event_name
–> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
139 def _bn_bias_state(self, with_bias): return norm_bias_params(self.model, with_bias).map(self.opt.state)

/databricks/python/lib/python3.7/site-packages/fastai/learner.py in (.0)
135 def _call_one(self, event_name):
136 assert hasattr(event, event_name), event_name
–> 137 [cb(event_name) for cb in sort_by_run(self.cbs)]
138
139 def _bn_bias_state(self, with_bias): return norm_bias_params(self.model, with_bias).map(self.opt.state)

/databricks/python/lib/python3.7/site-packages/fastai/callback/core.py in call(self, event_name)
42 (self.run_valid and not getattr(self, ‘training’, False)))
43 res = None
—> 44 if self.run and _run: res = getattr(self, event_name, noop)()
45 if event_name==‘after_fit’: self.run=True #Reset self.run to True at each end of fit
46 return res

/databricks/python/lib/python3.7/site-packages/fastai/callback/schedule.py in before_batch(self)
84 def init(self, scheds): self.scheds = scheds
85 def before_fit(self): self.hps = {p:[] for p in self.scheds.keys()}
—> 86 def before_batch(self): self._update_val(self.pct_train)
87
88 def _update_val(self, pct):

/databricks/python/lib/python3.7/site-packages/fastai/callback/schedule.py in _update_val(self, pct)
87
88 def _update_val(self, pct):
—> 89 for n,f in self.scheds.items(): self.opt.set_hyper(n, f(pct))
90
91 def after_batch(self):

/databricks/python/lib/python3.7/site-packages/fastai/callback/schedule.py in _inner(pos)
67 if pos == 1.: return scheds-1
68 idx = (pos >= pcts).nonzero().max()
—> 69 actual_pos = (pos-pcts[idx]) / (pcts[idx+1]-pcts[idx])
70 return schedsidx
71 return _inner

IndexError: index 3 is out of bounds for dimension 0 with size 3

That should be fixed now - please ensure you have the latest version of fastai.

Apologies for the bug!

1 Like

@helenas I haven’t fixed it yet. I just circumvented it by reverting to fastai v1.0.61. I might test this in the coming weeks but can’t promise anything.

I hope Jeremys bug fix announcement helps yout out :slight_smile:

Hi @tokleine,

Unfortunately, I am also running into the same error still also. Did you revert back to fastai v1.0.61 using this command?
!pip install --user https://github.com/fastai/fastai1/archive/master.zip

Thanks for the help! :slight_smile:

Hi @helenas,

I did use, but on a Databricks cluster, unsure how it works locally with dependencies.

pip install fastai==1.0.61

The verison history of fastai can be found here:

Hope this helps :slight_smile: