VGRNN icon indicating copy to clipboard operation
VGRNN copied to clipboard

Failed to load data

Open Yusufma03 opened this issue 5 years ago • 10 comments

Hi,

I'm trying to run your code but always fail to load the data at this line. Please find below the error log:

UnicodeDecodeError: 'ascii' codec can't decode byte 0x96 in position 8: ordinal not in range(128)

Thanks for your help!

Yusufma03 avatar Jan 14 '20 08:01 Yusufma03

It seems to be implemented with Python2.x and the pickle.load() should be added a parameter 'encoding = iso-8859-1' to load strings in Python3.x.

xiaowenmasfather avatar Jan 16 '20 11:01 xiaowenmasfather

I have followed xiaowenmasfather's suggestion, but a new error occured in the same line.

TypeError: a bytes-like object is required, not 'str'

And I also ran it in python2.x, but get the following error

ValueError: Number of dimensions of src and index tensor do not match, got 1 and 2 in

kld_loss, nll_loss, _, _, hidden_st = model(x_in[seq_start:seq_end]
                                                , edge_idx_list[seq_start:seq_end]
                                                , adj_orig_dense_list[seq_start:seq_end])

DoufuX avatar Jan 17 '20 06:01 DoufuX

with open('data/fb/adj_time_list.pickle', 'rb') as handle: adj_time_list = pickle.load(handle,encoding='iso-8859-1')

with open('data/fb/adj_orig_dense_list.pickle', 'rb') as handle: adj_orig_dense_list = pickle.load(handle,encoding='bytes')

I load the fb_dataset in Python3.6 and it works. But there are still some errors in the model forward stage and I'm still working on it. Hope the author would release the enviroment requirements

xiaowenmasfather avatar Jan 18 '20 03:01 xiaowenmasfather

@DoufuX @xiaowenmasfather

The error related to dimension is caused by incorrect torch_geometric version. I used the latest torch_geometric==4.2.2 and had the same error as yours.

You need to change all of the returning variables of function add_self_loops like this:

edge_index, _ = add_self_loops(edge_index, num_nodes=x.size(0))

Cogito2012 avatar Jan 20 '20 15:01 Cogito2012

Hi,

Sorry for the long delay in responding to the comments. I added the requirements to README. Please let me know if you still get errors.

Thanks, Arman

VGraphRNN avatar Jul 08 '20 04:07 VGraphRNN

How to solve this error RuntimeError: expand(torch.LongTensor{[2, 1381]}, size=[1381]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

mengkai514 avatar Nov 24 '22 09:11 mengkai514

with open('data/fb/adj_time_list.pickle', 'rb') as handle: adj_time_list = pickle.load(handle,encoding='iso-8859-1')

with open('data/fb/adj_orig_dense_list.pickle', 'rb') as handle: adj_orig_dense_list = pickle.load(handle,encoding='bytes')

I load the fb_dataset in Python3.6 and it works. But there are still some errors in the model forward stage and I'm still working on it. Hope the author would release the enviroment requirements

lifesaver

yh-yao avatar Jan 11 '23 20:01 yh-yao

How to solve this error RuntimeError: expand(torch.LongTensor{[2, 1381]}, size=[1381]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

I have the same problem.

tabatabaeifateme avatar Jun 26 '23 08:06 tabatabaeifateme

How to solve this error RuntimeError: expand(torch.LongTensor{[2, 1381]}, size=[1381]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

I have the same problem. I have solved this problem, here GCN may be a little problem, I suggest you change or use the torch_geometric library GCN

mengkai514 avatar Jun 26 '23 08:06 mengkai514

How to solve this error RuntimeError: expand(torch.LongTensor{[2, 1381]}, size=[1381]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

you can change your GCN as same as https://github.com/cbhua/trajectory-prediction. The scatter_ function should alter too.

kongtou-1 avatar Dec 13 '23 01:12 kongtou-1