VGraphRNN / VGRNN

Variational Graph Recurrent Neural Networks - PyTorch
114 stars 32 forks source link

Failed to load data #1

Open Yusufma03 opened 4 years ago

Yusufma03 commented 4 years ago

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!

xiaowenmasfather commented 4 years ago

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.

DoufuX commented 4 years ago

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])
xiaowenmasfather commented 4 years ago

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

Cogito2012 commented 4 years ago

@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:

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

VGraphRNN commented 4 years ago

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

mengkai514 commented 1 year ago

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)

yh-yao commented 1 year ago

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

Fatemeh-Tabatabaeii commented 1 year ago

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.

mengkai514 commented 1 year ago

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

kongtou-1 commented 11 months ago

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.