Closed stsour closed 3 years ago
Thanks, that solved the error I was seeing. However, now I am getting this error when testing with your data:
RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1, 1] because the unspecified dimension size -1 can be any value and is ambiguous
I tried changing the batch size in capsule_network_emb_cpu.py, but this did not help.
By running which specific code there is this error? I tried capsule_network_emb_cpu.py and prediction_emb_cpu.py and didn't see this error. Maybe you can show the complete error message?
I was getting that error when running capsule_network_emb_cpu.py. I tried again and it worked on your dataset, but not mine. The losses do seem to be lower than before though.
Here is the complete error message I am getting. I also attached my training and testing data.
[> 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 25000/25000 [40:22<00:00, 10.32it/s]
[Epoch 1] Training Loss: 0.0463 (MSE: 7.0000) [Epoch 1] Testing Loss: 0.0414 (MSE: 7.0000) Traceback (most recent call last): File "capsule_network_emb_cpu.py", line 743, in
engine.train(processor, get_rt_iterator(True), maxepoch=NUM_EPOCHS, optimizer=optimizer) File "/home/tsour.s/.local/lib/python3.7/site-packages/torchnet/engine/engine.py", line 67, in train self.hook('on_end_epoch', state) File "/home/tsour.s/.local/lib/python3.7/site-packages/torchnet/engine/engine.py", line 31, in hook self.hooksname File "capsule_network_emb_cpu.py", line 671, in on_end_epoch pred_batch = model(test_batch) File "/home/tsour.s/.local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, *kwargs) File "capsule_network_emb_cpu.py", line 275, in forward x = self.primary_capsules(x) File "/home/tsour.s/.local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(input, kwargs) File "capsule_network_emb_cpu.py", line 149, in forward outputs = [capsule(x).view(x.size(0), -1, 1) for capsule in self.capsules] File "capsule_network_emb_cpu.py", line 149, in outputs = [capsule(x).view(x.size(0), -1, 1) for capsule in self.capsules] RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1, 1] because the unspecified dimension size -1 can be any value and is ambiguous** ]
Thanks for sharing the data, now I am able to reproduce the error. It turns out the cause is the same as before, the number of testing samples (100000) is divisible by the batch size (16), so please change line 632 to e.g.
PRED_BATCH = 166 # a number doesn't divide the sample size
It seems now the correlation is higher (~0.974 after the 1st epoch).
Ahhh, now I feel silly. I tested another batch size, but I guess it also by chance divided evenly. My mistake, I should have been more thorough checking that. Just tried it again, and it worked like a charm 👍
Thanks so much for your help, I really appreciate your responsiveness!
Hi there,
I was quite successful using DeepRTplus last year, but I am now having trouble working with a new dataset. I have attached my testing and training files. The training runs without error, but the resulting correlation with the test set is very low, 0.2-0.25.
I tried running the software again on the previous dataset I used with similar results. I tried re-cloning the software and starting with unmodified files, with no luck. I then tried with your datasets using
and the following error was thrown:
Any idea what the issue might be?
Thanks!