quancore / social-lstm

Social LSTM implementation in PyTorch
423 stars 254 forks source link

TypeError: No loop matching the specified signature and casting was found for ufunc svd_n_f #8

Closed saruvora closed 5 years ago

saruvora commented 5 years ago

Hi, thank you for sharing the code. I am training the model with all the datasets except stanford dataset I am facing some errors while using it on ubuntu

File "/workspace/code/helper.py", line 87, in sample_gaussian_2d next_values = np.random.multivariate_normal(mean, cov, 1) File "mtrand.pyx", line 4521, in mtrand.RandomState.multivariate_normal File "/opt/conda/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 1562, in svd u, s, vh = gufunc(a, signature=signature, extobj=extobj) TypeError: No loop matching the specified signature and casting was found for ufunc svd_n_f

can someone help me fix it, please? and if possible can someone share a pre-trained model for this network?

joanacfcampos commented 5 years ago

Hi! I am having the same issue. Did you manage to fix it? I wonder if it has to do with the version of pytorch

quancore commented 5 years ago

Hi, thank you for sharing the code. I am training the model with all the datasets except stanford dataset I am facing some errors while using it on ubuntu

File "/workspace/code/helper.py", line 87, in sample_gaussian_2d next_values = np.random.multivariate_normal(mean, cov, 1) File "mtrand.pyx", line 4521, in mtrand.RandomState.multivariate_normal File "/opt/conda/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 1562, in svd u, s, vh = gufunc(a, signature=signature, extobj=extobj) TypeError: No loop matching the specified signature and casting was found for ufunc svd_n_f

can someone help me fix it, please? and if possible can someone share a pre-trained model for this network?

Because one of the functions in PyTOrch has been changed in the new release, it is causing the error.

saruvora commented 5 years ago

hi yes,

you need to change the following lines in helper.py under sample_gaussian_2d()

mean = [o_mux[node], o_muy[node]] cov = [[o_sx[node]*o_sx[node], o_corr[node]*o_sx[node]*o_sy[node]], [o_corr[node]*o_sx[node]*o_sy[node], o_sy[node]*o_sy[node]]] mean = np.array(mean, dtype='float') cov = np.array(cov, dtype='float') next_values = np.random.multivariate_normal(mean, cov, 1)

and also if you are using cuda then you will need to add the following lines at certain places in the train.py in order to convert the tensor to cuda() format: if args.use_cuda: x_seq = x_seq.cuda() x_seq, first_values_dict = vectorize_seq(x_seq, PedsList_seq, lookup_seq)

quancore commented 5 years ago

hi yes,

you need to change the following lines in helper.py under sample_gaussian_2d()

mean = [o_mux[node], o_muy[node]] cov = [[o_sx[node]*o_sx[node], o_corr[node]*o_sx[node]*o_sy[node]], [o_corr[node]*o_sx[node]*o_sy[node], o_sy[node]*o_sy[node]]] mean = np.array(mean, dtype='float') cov = np.array(cov, dtype='float') next_values = np.random.multivariate_normal(mean, cov, 1)

and also if you are using cuda then you will need to add the following lines at certain places in the train.py in order to convert the tensor to cuda() format: if args.use_cuda: x_seq = x_seq.cuda() x_seq, first_values_dict = vectorize_seq(x_seq, PedsList_seq, lookup_seq)

Can you create PR on a separate branch for repo?

saruvora commented 5 years ago

Hi I am new to git so I couldn't create a PR but I have added the files here

mirsking commented 5 years ago

Thanks for the help of @quancore , I add a pull request to fix this error with torch 1.1.