OverflowError in transform.py Randomizable
set_random_state()
with seed
#7871
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes # teamtomo/membrain-seg#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 int64MONAI/monai/utils/misc.py
Lines 84 to 85 in 08d5728
For reference, here is a copy of the original bug report
Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.