Open jiezhangGt opened 1 year ago
when I use python train.py to train a model from scratch, I met this problem!
'''shell Epoch 1 --- Training --- :: 0%| | 0/34 [00:02<?, ?it/s] torch.Size([1, 512, 37, 50]) torch.Size([1, 512, 37, 50]) fuse5 torch.Size([1, 1, 592, 800]) fuse4 torch.Size([1, 1, 600, 800]) fuse3 torch.Size([1, 1, 600, 800]) fuse2 torch.Size([1, 1, 600, 800]) fuse1 torch.Size([1, 1, 600, 800]) Traceback (most recent call last): File "train.py", line 200, in main() File "train.py", line 67, in main pred = trainer.train_op(data, target) File "/ssd10/exec/zhangjie07/2023/cnen_online/tmp/DeepCrack/DeepCrack/DeepCrack-master/codes/trainer.py", line 40, in train_op pred_output, pred_fuse5, pred_fuse4, pred_fuse3, pred_fuse2, pred_fuse1, = self.model(input) File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, kwargs) File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 171, in forward outputs = self.parallel_apply(replicas, inputs, kwargs) File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 181, in parallel_apply return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)]) File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 89, in parallel_apply output.reraise() File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/_utils.py", line 543, in reraise raise exception RuntimeError: Caught RuntimeError in replica 0 on device 0. Original Traceback (most recent call last): File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 64, in _worker output = module(*input, *kwargs) File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(input, kwargs) File "/ssd10/exec/zhangjie07/2023/cnen_online/tmp/DeepCrack/DeepCrack/DeepCrack-master/codes/model/deepcrack.py", line 166, in forward output = self.final(torch.cat([fuse5,fuse4,fuse3,fuse2,fuse1],1)) RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 592 but got size 600 for tensor number 1 in the list.
'''
And my train dataset is CrackTree260:
'''shell DeepCrack-datasets/CrackTree260/CrackTree260/6223.jpg DeepCrack-datasets/CrackTree260/CrackTree260_gt/gt/6223.bmp DeepCrack-datasets/CrackTree260/CrackTree260/6224.jpg DeepCrack-datasets/CrackTree260/CrackTree260_gt/gt/6224.bmp DeepCrack-datasets/CrackTree260/CrackTree260/6225.jpg DeepCrack-datasets/CrackTree260/CrackTree260_gt/gt/6225.bmp '''
How can i solve this problem? thanks!!
do you solve the problem, i come up against it now, too. I try to find that it can only interface pic's size is 512 * 512
when I use python train.py to train a model from scratch, I met this problem!
'''shell Epoch 1 --- Training --- :: 0%| | 0/34 [00:02<?, ?it/s] torch.Size([1, 512, 37, 50]) torch.Size([1, 512, 37, 50]) fuse5 torch.Size([1, 1, 592, 800]) fuse4 torch.Size([1, 1, 600, 800]) fuse3 torch.Size([1, 1, 600, 800]) fuse2 torch.Size([1, 1, 600, 800]) fuse1 torch.Size([1, 1, 600, 800]) Traceback (most recent call last): File "train.py", line 200, in
main()
File "train.py", line 67, in main
pred = trainer.train_op(data, target)
File "/ssd10/exec/zhangjie07/2023/cnen_online/tmp/DeepCrack/DeepCrack/DeepCrack-master/codes/trainer.py", line 40, in train_op
pred_output, pred_fuse5, pred_fuse4, pred_fuse3, pred_fuse2, pred_fuse1, = self.model(input)
File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, kwargs)
File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 171, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 181, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 89, in parallel_apply
output.reraise()
File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/_utils.py", line 543, in reraise
raise exception
RuntimeError: Caught RuntimeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 64, in _worker
output = module(*input, *kwargs)
File "/ssd8/exec/zhangjie07/2023/ALLMs/code/huggingface/transformers_venv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(input, kwargs)
File "/ssd10/exec/zhangjie07/2023/cnen_online/tmp/DeepCrack/DeepCrack/DeepCrack-master/codes/model/deepcrack.py", line 166, in forward
output = self.final(torch.cat([fuse5,fuse4,fuse3,fuse2,fuse1],1))
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 592 but got size 600 for tensor number 1 in the list.
'''
And my train dataset is CrackTree260:
'''shell DeepCrack-datasets/CrackTree260/CrackTree260/6223.jpg DeepCrack-datasets/CrackTree260/CrackTree260_gt/gt/6223.bmp DeepCrack-datasets/CrackTree260/CrackTree260/6224.jpg DeepCrack-datasets/CrackTree260/CrackTree260_gt/gt/6224.bmp DeepCrack-datasets/CrackTree260/CrackTree260/6225.jpg DeepCrack-datasets/CrackTree260/CrackTree260_gt/gt/6225.bmp '''
How can i solve this problem? thanks!!