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

1_train_predictor --save_fig error #21

Open
drpetershaw opened this issue Jan 28, 2019 · 3 comments
Open

1_train_predictor --save_fig error #21

drpetershaw opened this issue Jan 28, 2019 · 3 comments

Comments

@drpetershaw
Copy link

When i use:

!python /content/drive/My\ Drive/PlasmaSimAI/RNN/1_train_predictor.py --data ecg --filename chfdbchf15.pkl --save_fig

in Google colab the following error occurs:

=> Start training from scratch


Namespace(augment=True, batch_size=64, bptt=50, clip=10, data='ecg', device='cuda', dropout=0.2, emsize=32, epochs=50, eval_batch_size=64, filename='chfdbchf15.pkl', log_interval=10, lr=0.0002, model='LSTM', nhid=32, nlayers=2, prediction_window_size=10, pretrained=False, res_connection=False, resume=False, save_fig=True, save_interval=10, seed=1111, teacher_forcing_ratio=0.7, tied=False, weight_decay=0.0001)

| epoch 1 | 10/ 31 batches | ms/batch 133.2217 | loss 2.27
| epoch 1 | 20/ 31 batches | ms/batch 117.8518 | loss 1.95
| epoch 1 | 30/ 31 batches | ms/batch 117.6507 | loss 2.02

| end of epoch 1 | time: 4.70s | valid loss 1.6075 |

Traceback (most recent call last):
File "/content/drive/My Drive/PlasmaSimAI/RNN/1_train_predictor.py", line 326, in
generate_output(args,epoch,model,gen_dataset,startPoint=1500)
File "/content/drive/My Drive/PlasmaSimAI/RNN/1_train_predictor.py", line 141, in generate_output
target= preprocess_data.reconstruct(gen_dataset.cpu().numpy(), TimeseriesData.mean, TimeseriesData.std)
File "/content/drive/My Drive/PlasmaSimAI/RNN/preprocess_data.py", line 18, in reconstruct
return seqData*std+mean
TypeError: mul(): argument 'other' (position 1) must be Tensor, not numpy.ndarray

When you remove --save_fig the code works as expected. Is this a bug or am i doing something wrong?

@drpetershaw
Copy link
Author

Further digging makes me believe that it may be an issue with Pytorch compatibility as i have Pytorch Version=1.0.0

@chickenbestlover
Copy link
Owner

chickenbestlover commented Jan 31, 2019

I tried to run this code in 1.0.0 with the --save_fig option and the same error occurred.

@chickenbestlover
Copy link
Owner

chickenbestlover commented Jan 31, 2019

It seems that the error occurred because multiplication between Numpy array and Pytorch tensor is deprecated in Pytorch 1.0.0.
I have fixed the error so check it out.

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