Skip to content

Fix integer overflow error in StratifiedCoordinateSampler class - #1

Open
michael-0brien wants to merge 1 commit into
3dem:masterfrom
michael-0brien:master
Open

Fix integer overflow error in StratifiedCoordinateSampler class#1
michael-0brien wants to merge 1 commit into
3dem:masterfrom
michael-0brien:master

Conversation

@michael-0brien

Copy link
Copy Markdown

Hello! I am encountering the following issue when running the filament picker through RELION 5.0.1:

File "path/to/topaz/utils/data/sampler.py", line 157, in __next__
    h = i*2**56 + j*2**32 + c

OverflowError: Python integer 4294967296 out of bounds for uint32

Basically, one or more of i, j, and c are being set to torch.uint32s, rather than Python integers. Looking at the commit history between here and the main repository, I am not sure why this error would occur, except possibly changes to the behavior of torch in newer versions?

Side note: I realize that this is an appropriate issue to raise with the main topaz repository, but I haven't gotten a chance to reproduce the error with a non-filament picking pipeline yet, so wanted to just start by raising the issue here!

Output of uv pip list:

Using Python 3.11.14 environment at: /my/path/to/topaz_venv
Package                Version     Editable project location
---------------------- ----------- -----------------------------------------
contourpy              1.3.3
cuda-bindings          13.3.1
cuda-pathfinder        1.5.5
cuda-toolkit           13.0.2
cycler                 0.12.1
filelock               3.29.4
fonttools              4.63.0
fsspec                 2026.6.0
future                 1.0.0
imageio                2.37.3
jinja2                 3.1.6
joblib                 1.5.3
kiwisolver             1.5.0
lazy-loader            0.5
markupsafe             3.0.3
matplotlib             3.11.0
mpmath                 1.3.0
narwhals               2.22.1
networkx               3.6.1
numpy                  2.4.6
nvidia-cublas          13.1.1.3
nvidia-cuda-cupti      13.0.85
nvidia-cuda-nvrtc      13.0.88
nvidia-cuda-runtime    13.0.96
nvidia-cudnn-cu13      9.20.0.48
nvidia-cufft           12.0.0.61
nvidia-cufile          1.15.1.6
nvidia-curand          10.4.0.35
nvidia-cusolver        12.0.4.66
nvidia-cusparse        12.6.3.3
nvidia-cusparselt-cu13 0.8.1
nvidia-nccl-cu13       2.29.7
nvidia-nvjitlink       13.0.88
nvidia-nvshmem-cu13    3.4.5
nvidia-nvtx            13.0.85
packaging              26.2
pandas                 3.0.3
pillow                 12.2.0
pyarrow                24.0.0
pyparsing              3.3.2
python-dateutil        2.9.0.post0
scikit-image           0.26.0
scikit-learn           1.9.0
scipy                  1.17.1
setuptools             81.0.0
six                    1.17.0
sympy                  1.14.0
threadpoolctl          3.6.0
tifffile               2026.3.3
topaz-em               0.2.5a0     /my/path/to/topaz
torch                  2.12.1
triton                 3.7.1
typing-extensions      4.15.0

@michael-0brien

Copy link
Copy Markdown
Author

See also here: tbepler#261

@michael-0brien

Copy link
Copy Markdown
Author

Looks like this is an auto conversion due to newer versions of torch, but that newer versions of topaz no longer encounter.

Until filament picking is upstream, this simple patch does seem to correct the bug!

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

Successfully merging this pull request may close these issues.

1 participant