Compute _unique_2d on the device instead of through Python sets - #45
Open
MarcosAsh wants to merge 1 commit into
Open
Compute _unique_2d on the device instead of through Python sets#45MarcosAsh wants to merge 1 commit into
MarcosAsh wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
_unique_2ddeduplicated rows with a Pythonsetand built the inverse from adict, calling.tolist()once per row each way. It runs insidectc_decode's per timestep beam loop, so every step round tripped the whole path array through the host. This uses the device side lexsortuniquealready has in_unique_prepareinstead.It also fixes the inverse. The old code built
unique_dictafter padding, so whenfill_valuematched a genuinely unique row the padding entry won and the inverse pointed at a padding row. That is reachable fromctc_decode, which pads with -1 while an all -1 row is a real path.This fixes the
test_ctc_decodeCI flake, which is the test behind four of the last five genuine CI failures. It segfaults in teardown after the test itself passes, and reproduces locally at about 2.5%. Running main and this branch interleaved, 600 runs each, gives 15 crashes on main and 0 here, one tailed p of 3e-5.nn_test.pyandnumpy_test.pygive 5750 passed and 0 failed, plus a differential test against the old implementation over 400 random inputs.