Describe the bug
Hi, there!
I'm following the tutorial with the spliceosome dataset (EMPIAR-10180). I have completed the "prepare data" stage, running dsdsh prepare to get the .pkl files for ctf and euler angles. Also, I created single .star and .mrcs files with relion_stack_create, and everything OK so far. However, in the training step, I'm having the following error immediately after starting the first epoch.
current_ind: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
0%| | 0/1538 [00:08<?, ?it/s]
Traceback (most recent call last):
File "/home/spa/anaconda3/envs/dsd/bin/dsd", line 8, in
sys.exit(main())
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/main.py", line 59, in main
args.func(args)
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/commands/train_cv.py", line 955, in main
train_batch(model, lattice, y, yt, rot, tran, optim, beta,
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/commands/train_cv.py", line 134, in train_batch
z_mu, z_logstd, z, y_recon, y_recon_tilt, losses, y, y_ffts, mus, euler_samples, y_recon_ori, neg_mus, mask_sum = run_batch(
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/commands/train_cv.py", line 319, in run_batch
z, encout = model.vanilla_encode(diff, rot, trans, eulers=euler, num_gpus=args.num_gpus, snr2=snr2)
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/models.py", line 225, in vanilla_encode
encout = self.encoder(img, rots, trans, losslist=["kldiv"], eulers=eulers, snr=snr)
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/parallel/data_parallel.py", line 168, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/parallel/data_parallel.py", line 178, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/parallel/parallel_apply.py", line 86, in parallel_apply
output.reraise()
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/_utils.py", line 457, in reraise
raise exception
RuntimeError: Caught RuntimeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/parallel/parallel_apply.py", line 61, in _worker
output = module(*input, **kwargs)
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/models.py", line 682, in forward
x_fft = self.translate_ft2d(x_fft, -trans[i:i+1]*self.render_size/self.vol_size)
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/models.py", line 612, in translate_ft2d
tfilt = coords @ t * 2 * np.pi # BxCxHxWx1
RuntimeError: Expected size for first two dimensions of batch2 tensor to be: [104, 2] but got: [104, 3].
To Reproduce
dsd train_cv /home/spa/data/EMPIAR_10180/10180/data/Spliceosome_edit_mrcs/Runs/000210_ProtRelionExportParticles/Export/all.mrcs --ctf /home/spa/data/EMPIAR_10180/10180/data/Spliceosome_edit_mrcs/Runs/000210_ProtRelionExportParticles/Export/all_ctf.pkl --poses /home/spa/data/EMPIAR_10180/10180/data/Spliceosome_edit_mrcs/Runs/000210_ProtRelionExportParticles/Export/all_pose_euler.pkl --lazy-single --pe-type vanilla --encode-mode grad --template-type conv -n 20 -b 12 --zdim 12 --lr 1.e-4 --num-gpus 4 --multigpu --beta-control 2. --beta cos -o ./sp -r ./global_mask.mrc --downfrac 0.33 --valfrac 0.25 --lamb 1. --split sp-split.pkl --bfactor 4. --templateres 224
Expected behavior
Since I followed all the steps required to enter the "training" stage, I was expecting to go through the 1st epoch. Before reaching this part, the terminal outputs that particles were successfully loaded into memory. Both ctf and euler .pkl files of the first particle are also outputted.
Additional context
There is a slight modification in the input particle set compared with the tutorial. Apparently, there are a couple of images in the original .mrcs file deposited in EMPIAR that seems to be somehow corrupted, with pixels showing NaN values. Therefore, I created a subset of 100k randomly-selected particles that excluded the corrupted ones. It was this 100k-subset the one that went through the "prepare data" stage mentioned in the description of the bug.
Many thanks for your time, and looking forward to trying this amazing software!
Best,
Marcos.
Describe the bug
Hi, there!
I'm following the tutorial with the spliceosome dataset (EMPIAR-10180). I have completed the "prepare data" stage, running dsdsh prepare to get the .pkl files for ctf and euler angles. Also, I created single .star and .mrcs files with relion_stack_create, and everything OK so far. However, in the training step, I'm having the following error immediately after starting the first epoch.
current_ind: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
0%| | 0/1538 [00:08<?, ?it/s]
Traceback (most recent call last):
File "/home/spa/anaconda3/envs/dsd/bin/dsd", line 8, in
sys.exit(main())
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/main.py", line 59, in main
args.func(args)
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/commands/train_cv.py", line 955, in main
train_batch(model, lattice, y, yt, rot, tran, optim, beta,
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/commands/train_cv.py", line 134, in train_batch
z_mu, z_logstd, z, y_recon, y_recon_tilt, losses, y, y_ffts, mus, euler_samples, y_recon_ori, neg_mus, mask_sum = run_batch(
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/commands/train_cv.py", line 319, in run_batch
z, encout = model.vanilla_encode(diff, rot, trans, eulers=euler, num_gpus=args.num_gpus, snr2=snr2)
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/models.py", line 225, in vanilla_encode
encout = self.encoder(img, rots, trans, losslist=["kldiv"], eulers=eulers, snr=snr)
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/parallel/data_parallel.py", line 168, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/parallel/data_parallel.py", line 178, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/parallel/parallel_apply.py", line 86, in parallel_apply
output.reraise()
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/_utils.py", line 457, in reraise
raise exception
RuntimeError: Caught RuntimeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/parallel/parallel_apply.py", line 61, in _worker
output = module(*input, **kwargs)
File "/home/spa/anaconda3/envs/dsd/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/models.py", line 682, in forward
x_fft = self.translate_ft2d(x_fft, -trans[i:i+1]*self.render_size/self.vol_size)
File "/home/spa/scipion/software/em/opusDSD/cryodrgn/models.py", line 612, in translate_ft2d
tfilt = coords @ t * 2 * np.pi # BxCxHxWx1
RuntimeError: Expected size for first two dimensions of batch2 tensor to be: [104, 2] but got: [104, 3].
To Reproduce
dsd train_cv /home/spa/data/EMPIAR_10180/10180/data/Spliceosome_edit_mrcs/Runs/000210_ProtRelionExportParticles/Export/all.mrcs --ctf /home/spa/data/EMPIAR_10180/10180/data/Spliceosome_edit_mrcs/Runs/000210_ProtRelionExportParticles/Export/all_ctf.pkl --poses /home/spa/data/EMPIAR_10180/10180/data/Spliceosome_edit_mrcs/Runs/000210_ProtRelionExportParticles/Export/all_pose_euler.pkl --lazy-single --pe-type vanilla --encode-mode grad --template-type conv -n 20 -b 12 --zdim 12 --lr 1.e-4 --num-gpus 4 --multigpu --beta-control 2. --beta cos -o ./sp -r ./global_mask.mrc --downfrac 0.33 --valfrac 0.25 --lamb 1. --split sp-split.pkl --bfactor 4. --templateres 224
Expected behavior
Since I followed all the steps required to enter the "training" stage, I was expecting to go through the 1st epoch. Before reaching this part, the terminal outputs that particles were successfully loaded into memory. Both ctf and euler .pkl files of the first particle are also outputted.
Additional context
There is a slight modification in the input particle set compared with the tutorial. Apparently, there are a couple of images in the original .mrcs file deposited in EMPIAR that seems to be somehow corrupted, with pixels showing NaN values. Therefore, I created a subset of 100k randomly-selected particles that excluded the corrupted ones. It was this 100k-subset the one that went through the "prepare data" stage mentioned in the description of the bug.
Many thanks for your time, and looking forward to trying this amazing software!
Best,
Marcos.