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

invalid argument 0 error #3

Open
armheb opened this issue Oct 8, 2019 · 0 comments
Open

invalid argument 0 error #3

armheb opened this issue Oct 8, 2019 · 0 comments

Comments

@armheb
Copy link

armheb commented Oct 8, 2019

Thanks for your repo, I tried to use your implementation but I keep getting this error when trying to train the model using learn.fit_one_cycle(20, max_lr=1e-2, callbacks=stage1_callbacks).
this is the trace of the error:
RuntimeError Traceback (most recent call last)
in
1 learn.fit_one_cycle(20, max_lr=1e-2,
----> 2 callbacks=stage1_callbacks
3 )

~/anaconda3/envs/fastai_v1/lib/python3.6/site-packages/fastai/train.py in fit_one_cycle(learn, cyc_len, max_lr, moms, div_factor, pct_start, final_div, wd, callbacks, tot_epochs, start_epoch)
20 callbacks.append(OneCycleScheduler(learn, max_lr, moms=moms, div_factor=div_factor, pct_start=pct_start,
21 final_div=final_div, tot_epochs=tot_epochs, start_epoch=start_epoch))
---> 22 learn.fit(cyc_len, max_lr, wd=wd, callbacks=callbacks)
23
24 def lr_find(learn:Learner, start_lr:Floats=1e-7, end_lr:Floats=10, num_it:int=100, stop_div:bool=True, wd:float=None):

~/anaconda3/envs/fastai_v1/lib/python3.6/site-packages/fastai/basic_train.py in fit(self, epochs, lr, wd, callbacks)
197 callbacks = [cb(self) for cb in self.callback_fns + listify(defaults.extra_callback_fns)] + listify(callbacks)
198 if defaults.extra_callbacks is not None: callbacks += defaults.extra_callbacks
--> 199 fit(epochs, self, metrics=self.metrics, callbacks=self.callbacks+callbacks)
200
201 def create_opt(self, lr:Floats, wd:Floats=0.)->None:

~/anaconda3/envs/fastai_v1/lib/python3.6/site-packages/fastai/basic_train.py in fit(epochs, learn, callbacks, metrics)
99 for xb,yb in progress_bar(learn.data.train_dl, parent=pbar):
100 xb, yb = cb_handler.on_batch_begin(xb, yb)
--> 101 loss = loss_batch(learn.model, xb, yb, learn.loss_func, learn.opt, cb_handler)
102 if cb_handler.on_batch_end(loss): break
103

~/anaconda3/envs/fastai_v1/lib/python3.6/site-packages/fastai/basic_train.py in loss_batch(model, xb, yb, loss_func, opt, cb_handler)
24 if not is_listy(xb): xb = [xb]
25 if not is_listy(yb): yb = [yb]
---> 26 out = model(*xb)
27 out = cb_handler.on_loss_begin(out)
28

~/anaconda3/envs/fastai_v1/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
491 result = self._slow_forward(*input, **kwargs)
492 else:
--> 493 result = self.forward(*input, **kwargs)
494 for hook in self._forward_hooks.values():
495 hook_result = hook(self, input, result)

//res2fg_n.py in forward(self, x)
287
288 #res2 block layers
--> 289 x = self.layer1(x)
290 x = self.layer2(x)
291 x = self.layer3(x)

~/anaconda3/envs/fastai_v1/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
491 result = self._slow_forward(*input, **kwargs)
492 else:
--> 493 result = self.forward(*input, **kwargs)
494 for hook in self._forward_hooks.values():
495 hook_result = hook(self, input, result)

~/anaconda3/envs/fastai_v1/lib/python3.6/site-packages/torch/nn/modules/container.py in forward(self, input)
90 def forward(self, input):
91 for module in self._modules.values():
---> 92 input = module(input)
93 return input
94

~/anaconda3/envs/fastai_v1/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
491 result = self._slow_forward(*input, **kwargs)
492 else:
--> 493 result = self.forward(*input, **kwargs)
494 for hook in self._forward_hooks.values():
495 hook_result = hook(self, input, result)

/res2fg_n.py in forward(self, x)
145 if self.scale > 1:
146 if self.first_block:
--> 147 out = torch.cat((out, self.pool(xs[len(self.convs)])), 1)
148 else:
149 out = torch.cat((out, xs[len(self.convs)]), 1)

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 32 and 30 in dimension 2 at /pytorch/aten/src/THC/generic/THCTensorMath.cu:71

Thanks

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

1 participant