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

DynaMight tensor mismatch - The size of tensor a (2) must match the size of tensor b (10000) at non-singleton dimension 2 #8

Open
Poko18 opened this issue Dec 13, 2023 · 2 comments

Comments

@Poko18
Copy link

Poko18 commented Dec 13, 2023

Hi,
I've been testing DynaMight on a set of particles from empiar (10028).
I downsampled the particles from box size 360px to 128px with relion_image_handler, and prepared a refined model of size 128x128px.

DynaMight command:

dynamight optimize-deformations --refinement-star-file data/Refine3D/job010/run_data.star
--initial-model data/Refine3D/job010/run_class001.mrc 
--output-directory dynamight_run_128/ 
--gpu-id 1 --n-gaussians 10000 --initial-threshold 0.08 --regularization-factor 1 --n-threads 4

Error:

Training on GPU 1
Initializing the particle dataset
Assigning a diameter of 462 angstrom
Number of particles: 105247
Initialized data loaders for half sets of size 47361  and  47362
consensus updates are done every  0  epochs.
box size: 128 pixel_size: 3.76875 virtual pixel_size: 0.007751937984496124  dimension of latent space:  5
Number of used gaussians: 10000
Optimizing scale only
Initializing gaussian positions from reference
100%|##########| 50/50 [00:02<00:00, 17.78it/s]
Final error: 9.401748684467748e-05
Optimizing scale only
Initializing gaussian positions from reference
100%|##########| 50/50 [00:02<00:00, 17.24it/s]
Final error: 9.401141142006963e-05
consensus gaussian models initialized
consensus model  initialization finished
mean distance in graph for half 1: 4.976639747619629 Angstrom ;This distance is also used to construct the initial graph 
mean distance in graph for half 2: 4.976908206939697 Angstrom ;This distance is also used to construct the initial graph 
Computing half-set indices
100%|##########| 83/83 [00:03<00:00, 25.17it/s]
100%|##########| 83/83 [00:06<00:00, 12.16it/s]
new regularization parameter for half 1 is  0
new regularization parameter for half 2 is  0
100%|#########9| 370/371 [00:47<00:00,  7.82it/s]
The size of tensor a (2) must match the size of tensor b (10000) at non-singleton dimension 2
WARNING! batch size too large for gpu, trying with new batch size of: 64

I'm getting a tensor mismatch, and it probably has something to do with the n_gaussians.
I was wondering if anyone else has encountered a similar problem?

@schwabjohannes
Copy link
Collaborator

Hi Poko,

I think it is the same bug, that the remainder of particle images and batch size is 1 for one of the dataloaders. I will fix this. As a workaround you can change the batch-size to --batch-size 120

I hope this works,

Johannes

@Poko18
Copy link
Author

Poko18 commented Dec 15, 2023

That worked, thanks!

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

2 participants