Skip to content

Found an element in 'lengths' that is <=0 in evaluation #24

@hayaldeniz

Description

@hayaldeniz

Hello everyone, I have an issue while running the code: first, it seems that everything is fine and the training is running, loss values are printed. But, after some time, I get this error:

Progress 0.07%, average loss 0.07827574014663696 Traceback (most recent call last):
File "/home/s6haoeze/DeepTTE/main.py", line 329, in
run()
File "/home/s6haoeze/DeepTTE/main.py", line 319, in run
train(model, elogger, train_set = config['train_set'], eval_set = config['eval_set'])
File "/home/s6haoeze/DeepTTE/main.py", line 241, in train
_, loss = model.eval_on_batch(attr, traj, config)
File "/home/s6haoeze/DeepTTE/models/DeepTTE.py", line 137, in eval_on_batch
entire_out, (local_out, local_length) = self(attr, traj, config)
File "/home/s6haoeze/anaconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/s6haoeze/DeepTTE/models/DeepTTE.py", line 124, in forward
sptm_s, sptm_l, sptm_t = self.spatio_temporal(traj, attr_t, config)
File "/home/s6haoeze/anaconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/s6haoeze/DeepTTE/models/base/SpatioTemporal.py", line 92, in forward
packed_inputs = nn.utils.rnn.pack_padded_sequence(conv_locs, lens, batch_first = True)
File "/home/s6haoeze/anaconda3/lib/python3.9/site-packages/torch/nn/utils/rnn.py", line 262, in pack_padded_sequence
_VF._pack_padded_sequence(input, lengths, batch_first)
RuntimeError: Length of all samples has to be greater than 0, but found an element in 'lengths' that is <= 0

Although in my dataset, the length of the trajectories are greater than 18, it seems that somewhere in the code some length is interpreted as shorter than 2 (the line lens = [x - self.kernel_size + 1 for x in traj['lens']] in SpatioTemporal.py). What can be done? Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions