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

train problem about tensor IndexError #99

Open
MandyZhang4869 opened this issue Apr 19, 2024 · 0 comments
Open

train problem about tensor IndexError #99

MandyZhang4869 opened this issue Apr 19, 2024 · 0 comments

Comments

@MandyZhang4869
Copy link

I used the command “>python train.py --eval_every 10 --vis_every
1 --train_data_dict eth_train.pkl --eval_data_dict eth_val.pkl --offline_scene_graph yes --preprocess_workers 5 --lo
g_dir ../experiments/pedestrians/models --log_tag _eth_vel_ar3 --train_epochs 100 --augment --conf ../experiments/ped
estrians/models/eth_vel/config.json
” to train the model,but there are somthing wrong(_pickle.PicklingError: Can't pickle ) as follow:
0%| | 0/148 [00:28<?, ?it/s] Traceback (most recent call last): File "train.py", line 440, in <module> main() File "train.py", line 251, in main for batch in pbar: File "E:\Users\Bourbon\anaconda3\envs\trajpp\lib\site-packages\tqdm\std.py", line 1127, in __iter__ for obj in iterable: File "E:\Users\Bourbon\anaconda3\envs\trajpp\lib\site-packages\torch\utils\data\dataloader.py", line 359, in __iter__ return self._get_iterator() File "E:\Users\Bourbon\anaconda3\envs\trajpp\lib\site-packages\torch\utils\data\dataloader.py", line 305, in _get_ite rator return _MultiProcessingDataLoaderIter(self) File "E:\Users\Bourbon\anaconda3\envs\trajpp\lib\site-packages\torch\utils\data\dataloader.py", line 918, in __init__ w.start() File "E:\Users\Bourbon\anaconda3\envs\trajpp\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "E:\Users\Bourbon\anaconda3\envs\trajpp\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "E:\Users\Bourbon\anaconda3\envs\trajpp\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "E:\Users\Bourbon\anaconda3\envs\trajpp\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__ reduction.dump(process_obj, to_child) File "E:\Users\Bourbon\anaconda3\envs\trajpp\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) _pickle.PicklingError: Can't pickle <function augment at 0x000002BA58ABDEA0>: attribute lookup augment on __main__ fail File "E:\Users\Bourbon\anaconda3\envs\trajpp\lib\multiprocessing\spawn.py", line 115, in _main self = reduction.pickle.load(from_parent)

I think maybe my commputer couldnt afford multiprocessing,so I changed the argument “--preprocess_workers 5 ” to “--preprocess_workers 0 ” ,and then there is another error:

Traceback (most recent call last): File "train.py", line 440, in <module> main() File "train.py", line 255, in main train_loss = trajectron.train_loss(batch, node_type) File "E:\motion_planning\dl_prediction\Trajectron-plus-plus\trajectron\model\trajectron.py", line 95, in train_loss prediction_horizon=self.ph) File "E:\motion_planning\dl_prediction\Trajectron-plus-plus\trajectron\model\mgcvae.py", line 991, in train_loss map=map) File "E:\motion_planning\dl_prediction\Trajectron-plus-plus\trajectron\model\mgcvae.py", line 458, in obtain_encode d_tensors first_history_indices) File "E:\motion_planning\dl_prediction\Trajectron-plus-plus\trajectron\model\mgcvae.py", line 611, in encode_edge ret = outputs[torch.arange(last_index_per_sequence.shape[0]), last_index_per_sequence] IndexError: tensors used as indices must be long, byte or bool tensors
I try to print the last_index_per_sequence,as follow,the tensor are Negative number, why? how can I solve the problem?
last_index_per_sequence: tensor(
[-1, -1, -1, -1, -7, -1, -3, -5, -1, -1, -4, -2, -2, -1, -1, -1, -1, -1,
-1, -1, -1, -6, -1, -1, -6, -1, -1, -6, -1, -5, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -3, -5, -1, -1,
-1, -1, -2, -1, -6, -1, -1, -1, -1, -1, -1, -1, -3, -1, -6, -1, -1, -7,
-1, -1, -7, -1, -2, -1, -1, -1, -6, -1, -1, -1, -1, -1, -1, -1, -1, -4,
-7, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -5, -1, -1, -1, -6, -1, -1, -1, -1, -1,
-7, -1, -1, -1, -1, -7, -1, -1, -1, -1, -1, -1, -1, -5, -1, -1, -1, -1,
-1, -1, -4, -6, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -4, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -6, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -1, -1,
-1, -1, -7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-3, -2, -1, -2, -1, -1, -1, -1, -1, -1, -1, -3, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -7])

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

1 participant