opendilab / SmartRefine

[CVPR 2024] SmartRefine: A Scenario-Adaptive Refinement Framework for Efficient Motion Prediction
Apache License 2.0
102 stars 8 forks source link

TypeError: file must have 'read' and 'readline' attributes #7

Open Lukas88664 opened 4 months ago

Lukas88664 commented 4 months ago

When I finished processing the data it showed this error File "/home/seivl/桌面/SmartRefine-main/datasets/argoverse_v1_dataset.py", line 79, in get return pickle.load(self.processed_paths[idx]), pickle.load(self._p1_paths[idx]) TypeError: file must have 'read' and 'readline' attributes

/home/seivl/anaconda3/envs/smart/bin/python /home/seivl/桌面/SmartRefine-main/train.py --data_root /home/seivl/桌面/pkl_data/ori --p1_root /home/seivl/桌面/pkl_data/pkl --exp smartref_hivt_argo1 --gpus 1 --embed_dim 64 --refine_num 5 --seg_num 2 --refine_radius -1 --r_lo 2 --r_hi 10 Global seed set to 2024 GPU available: True, used: True TPU available: False, using: 0 TPU cores IPU available: False, using: 0 IPUs Processing... 100%|██████████| 3/3 [00:00<00:00, 28.96it/s] Done! Processing... 100%|██████████| 3/3 [00:00<00:00, 12.89it/s] Done! Processing... 100%|██████████| 3/3 [00:00<00:00, 30.06it/s] Done! Processing... 100%|██████████| 3/3 [00:00<00:00, 29.99it/s] Done! LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]

| Name | Type | Params

0 | target_encoder | TargetRegion | 216 K 1 | reg_loss | LaplaceNLLLoss | 0
2 | cls_loss | SoftTargetCrossEntropyLoss | 0
3 | score_loss | ScoreRegL1Loss | 0
4 | minADE | ADE | 0
5 | minFDE | FDE | 0
6 | minMR | MR | 0

216 K Trainable params 0 Non-trainable params 216 K Total params 0.865 Total estimated model params size (MB) /home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/torch_geometric/deprecation.py:26: UserWarning: 'data.DataLoader' is deprecated, use 'loader.DataLoader' instead warnings.warn(out) Validation sanity check: 0%| | 0/1 [00:00<?, ?it/s]Traceback (most recent call last): File "/home/seivl/桌面/SmartRefine-main/train.py", line 45, in trainer.fit(model, datamodule) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 740, in fit self._call_and_handle_interrupt( File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 685, in _call_and_handle_interrupt return trainer_fn(*args, kwargs) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 777, in _fit_impl self._run(model, ckpt_path=ckpt_path) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1199, in _run self._dispatch() File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1279, in _dispatch self.training_type_plugin.start_training(self) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 202, in start_training self._results = trainer.run_stage() File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1289, in run_stage return self._run_train() File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1311, in _run_train self._run_sanity_check(self.lightning_module) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1375, in _run_sanity_check self._evaluation_loop.run() File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/loops/base.py", line 145, in run self.advance(*args, *kwargs) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 110, in advance dl_outputs = self.epoch_loop.run(dataloader, dataloader_idx, dl_max_batches, self.num_dataloaders) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/loops/base.py", line 140, in run self.on_run_start(args, kwargs) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 86, in on_run_start self._dataloader_iter = _update_dataloader_iter(data_fetcher, self.batch_progress.current.ready) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/loops/utilities.py", line 121, in _update_dataloader_iter dataloader_iter = enumerate(data_fetcher, batch_idx) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/utilities/fetching.py", line 199, in iter self.prefetching(self.prefetch_batches) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/utilities/fetching.py", line 258, in prefetching self._fetch_next_batch() File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/pytorch_lightning/utilities/fetching.py", line 300, in _fetch_next_batch batch = next(self.dataloader_iter) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 628, in next data = self._next_data() File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1333, in _next_data return self._process_data(data) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1359, in _process_data data.reraise() File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/torch/_utils.py", line 543, in reraise raise exception TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 58, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/seivl/anaconda3/envs/smart/lib/python3.8/site-packages/torch_geometric/data/dataset.py", line 289, in getitem data = self.get(self.indices()[idx]) File "/home/seivl/桌面/SmartRefine-main/datasets/argoverse_v1_dataset.py", line 79, in get return pickle.load(self.processed_paths[idx]), pickle.load(self._p1_paths[idx]) TypeError: file must have 'read' and 'readline' attributes

Lukas88664 commented 4 months ago

could you please help me ?

youngzhou1999 commented 4 months ago

It seems like a pickle issue.

Maybe you can try to load .pkl files separately and see if this works.

youngzhou1999 commented 4 months ago

Also, I've added my email address in README. Feel free to contact me.

( And a little tip: it's not proper to email professors directly for code problems. You can issue me on GitHub first. 😄

Lukas88664 commented 4 months ago

原谅我的唐突 我这边发邮件时没有加载出作者照片  感谢您 非常好的工作 谢谢!

------------------ Original ------------------ From: kmzy @.> Date: Wed,Jun 5,2024 5:08 PM To: opendilab/SmartRefine @.> Cc: Lukas88664 @.>, Author @.> Subject: Re: [opendilab/SmartRefine] TypeError: file must have 'read' and'readline' attributes (Issue #7)

Also, I've added my email address in README. Feel free to contact me.

( And a little tip: it's not proper to email professors directly for code problems. You can issue me on GitHub first. 😄

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

youngzhou1999 commented 4 months ago

Hi, I've updated the code and installation in https://github.com/opendilab/SmartRefine/?tab=readme-ov-file#getting-started.

Please use the newest code and read the doc to take a try.

Sorry for these problems. 😢

Lukas88664 commented 4 months ago

thanks a lot  i will try again 

------------------ Original ------------------ From: kmzy @.> Date: Thu,Jun 6,2024 8:59 PM To: opendilab/SmartRefine @.> Cc: Lukas88664 @.>, Author @.> Subject: Re: [opendilab/SmartRefine] TypeError: file must have 'read' and'readline' attributes (Issue #7)

Hi, I've updated the code and installation in https://github.com/opendilab/SmartRefine/?tab=readme-ov-file#getting-started.

Please use the newest code and read the doc to take a try.

Sorry for these problems. 😢

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>