You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like you are using pytorch 0.4. The error you got was due to updates in pytorch between versions 0.3 and 0.4. I updated the code, now everything should work just fine. Let me know if you have any issues!
when I am running train the model
for _ in range(n_iterations):
I experience this error
RuntimeError Traceback (most recent call last)
in ()
10
11 ### Transfer learning
---> 12 RL.transfer_learning(transfer_data, n_epochs=n_transfer)
13 _, prediction = estimate_and_update(n_to_generate)
14 prediction_log.append(prediction)
~/ReLeaSE/reinforcement.py in transfer_learning(self, data, n_epochs, augment)
131
132 def transfer_learning(self, data, n_epochs, augment=False):
--> 133 _ = self.generator.fit(data, n_epochs, augment=augment)
~/ReLeaSE/stackRNN.py in fit(self, data, n_epochs, all_losses, print_every, plot_every, augment)
330 for epoch in range(1, n_epochs + 1):
331 inp, target = data.random_training_set(smiles_augmentation)
--> 332 loss = self.train_step(inp, target)
333 loss_avg += loss
334
~/ReLeaSE/stackRNN.py in train_step(self, inp, target)
285 for c in range(len(inp)):
286 output, hidden, stack = self(inp[c], hidden, stack)
--> 287 loss += self.criterion(output, target[c])
288
289 loss.backward()
~/anaconda3/envs/ReLeaSE/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
489 result = self._slow_forward(*input, **kwargs)
490 else:
--> 491 result = self.forward(*input, **kwargs)
492 for hook in self._forward_hooks.values():
493 hook_result = hook(self, input, result)
~/anaconda3/envs/ReLeaSE/lib/python3.6/site-packages/torch/nn/modules/loss.py in forward(self, input, target)
757 _assert_no_grad(target)
758 return F.cross_entropy(input, target, self.weight, self.size_average,
--> 759 self.ignore_index, self.reduce)
760
761
~/anaconda3/envs/ReLeaSE/lib/python3.6/site-packages/torch/nn/functional.py in cross_entropy(input, target, weight, size_average, ignore_index, reduce)
1440 >>> loss.backward()
1441 """
-> 1442 return nll_loss(log_softmax(input, 1), target, weight, size_average, ignore_index, reduce)
1443
1444
~/anaconda3/envs/ReLeaSE/lib/python3.6/site-packages/torch/nn/functional.py in nll_loss(input, target, weight, size_average, ignore_index, reduce)
1326 raise ValueError('Expected 2 or more dimensions (got {})'.format(dim))
1327
-> 1328 if input.size(0) != target.size(0):
1329 raise ValueError('Expected input batch_size ({}) to match target batch_size ({}).'
1330 .format(input.size(0), target.size(0)))
RuntimeError: dimension specified as 0 but tensor has no dimensions
The text was updated successfully, but these errors were encountered: