Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lm_rnn.py concat returns "IndexError: list index out of range" #107

Closed
gsgbills opened this issue Jan 24, 2018 · 1 comment
Closed

lm_rnn.py concat returns "IndexError: list index out of range" #107

gsgbills opened this issue Jan 24, 2018 · 1 comment

Comments

@gsgbills
Copy link

IndexError Traceback (most recent call last)
in ()
1 m3.freeze_to(-1)
----> 2 m3.fit(lrs/2, 1, metrics=[accuracy])
3 m3.unfreeze()
4 m3.fit(lrs, 1, metrics=[accuracy], cycle_len=1)

~/fastai/courses/dl1/fastai/learner.py in fit(self, lrs, n_cycle, wds, **kwargs)
207 self.sched = None
208 layer_opt = self.get_layer_opt(lrs, wds)
--> 209 self.fit_gen(self.model, self.data, layer_opt, n_cycle, **kwargs)
210
211 def warm_up(self, lr, wds=None):

~/fastai/courses/dl1/fastai/learner.py in fit_gen(self, model, data, layer_opt, n_cycle, cycle_len, cycle_mult, cycle_save_name, use_clr, metrics, callbacks, use_wd_sched, norm_wds, wds_sched_mult, **kwargs)
154 n_epoch = sum_geom(cycle_len if cycle_len else 1, cycle_mult, n_cycle)
155 fit(model, data, n_epoch, layer_opt.opt, self.crit,
--> 156 metrics=metrics, callbacks=callbacks, reg_fn=self.reg_fn, clip=self.clip, **kwargs)
157
158 def get_layer_groups(self): return self.models.get_layer_groups()

~/fastai/courses/dl1/fastai/model.py in fit(model, data, epochs, opt, crit, metrics, callbacks, kwargs)
88 batch_num += 1
89 for cb in callbacks: cb.on_batch_begin()
---> 90 loss = stepper.step(V(x),V(y))
91 avg_loss = avg_loss * avg_mom + loss * (1-avg_mom)
92 debias_loss = avg_loss / (1 - avg_mom
batch_num)

~/fastai/courses/dl1/fastai/model.py in step(self, xs, y)
38 def step(self, xs, y):
39 xtra = []
---> 40 output = self.m(*xs)
41 if isinstance(output,(tuple,list)): output,*xtra = output
42 self.opt.zero_grad()

~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
323 for hook in self._forward_pre_hooks.values():
324 hook(self, input)
--> 325 result = self.forward(*input, **kwargs)
326 for hook in self._forward_hooks.values():
327 hook_result = hook(self, input, result)

~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/container.py in forward(self, input)
65 def forward(self, input):
66 for module in self._modules.values():
---> 67 input = module(input)
68 return input
69

~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
323 for hook in self._forward_pre_hooks.values():
324 hook(self, input)
--> 325 result = self.forward(*input, **kwargs)
326 for hook in self._forward_hooks.values():
327 hook_result = hook(self, input, result)

~/fastai/courses/dl1/fastai/lm_rnn.py in forward(self, input)
129 raw_outputs.append(r)
130 outputs.append(o)
--> 131 return self.concat(raw_outputs), self.concat(outputs)
132
133

~/fastai/courses/dl1/fastai/lm_rnn.py in concat(self, arrs)
117
118 def concat(self, arrs):
--> 119 return [torch.cat([l[si] for l in arrs]) for si in range(len(arrs[0]))]
120
121 def forward(self, input):

IndexError: list index out of range

@jph00
Copy link
Member

jph00 commented Jan 28, 2018

There isn't enough info here to replicate or fix the error. Best would be to ask on the forum including information about what you were doing when you got the error, and the details of your environment.

@jph00 jph00 closed this as completed Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants