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

ValueError: The provided lr scheduler "<torch.optim.lr_scheduler.CosineAnnealingLR object at 0x7b985d13d730>" is invalid #6

Open
Family-Liao opened this issue Jun 3, 2024 · 4 comments

Comments

@Family-Liao
Copy link

Family-Liao commented Jun 3, 2024

我在训练时遇到的报错,因为报错提示只有一行代码,trainer.fit(model, datamodule),我不知道如何修改,请问该如何解决
Snipaste_2024-06-03_15-41-18
这是我使用的包的版本
Snipaste_2024-06-03_15-24-11

@youngzhou1999
Copy link
Collaborator

您好。

方便的话,您可以试一下降低torch的版本,参考这个链接有人遇到了类似的问题:Lightning-AI/pytorch-lightning#17476

@Family-Liao
Copy link
Author

您好。

方便的话,您可以试一下降低torch的版本,参考这个链接有人遇到了类似的问题:Lightning-AI/pytorch-lightning#17476

好的,谢谢你的回答 @youngzhou1999

@Lukas88664
Copy link

您好。

方便的话,您可以试一下降低torch的版本,参考这个链接有人遇到了类似的问题:Lightning-AI/pytorch-lightning#17476

您好 我在复现代码的时候遇到了如下的问题 :
/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
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

您方便帮我看看吗

@youngzhou1999
Copy link
Collaborator

您好。

已经在您issue下回复。

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

3 participants