Open GenevieveBuckley opened 5 days ago
I'd like to add a test for this, however I'm having trouble reducing it to a minimal reproducible example, without involving the external membrain_seg
package.
Here's where I think the extra test case should go: https://github.com/Project-MONAI/MONAI/blob/08d572839ede5d087e49d4dfadba033e512528df/tests/test_randomizable.py#L37-L43
What I've tried so far is hitting the error, entering the debugger, and then copy-pasting the exact value of _seed
at that point into a new line in test_seed
, eg: inst.set_random_state(seed=np.uint32(1126710810))
... but running just this test case doesn't produce the same overflow error as before. I don't know if there are other types of hidden state complicating things.
Do you have any suggestions?
Hi @GenevieveBuckley This is cause by our incompatibility with Numpy 2.0. If you install a 1.* version this will go away. We're working on a fix now as a stopgap. I also had a previous PR on the same subject but if you wanted to work on other fixes we'll need these eventually. Thanks!
Fixes # https://github.com/teamtomo/membrain-seg/issues/70
Description
I'm using the membrain_seg package, which depends on MONAI, and have found that it consistently triggers an overflow error in MONAI
I've been able to fix the problem by ensuring both
_seed
andMAX_SEED
are 64 bit integers, like this:and this has fixed the problem for me.
I notice that when the OverflowError occurs,
_seed
is a numpy uint32 bit value. I suspect this is the source of the problem, sinceMAX_SEED
is by definition int64 https://github.com/Project-MONAI/MONAI/blob/08d572839ede5d087e49d4dfadba033e512528df/monai/utils/misc.py#L84-L85For reference, here is a copy of the original bug report
Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.