Repository navigation
Fix NERO crashing when CUDA is available - #660
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Found while testing #658: on a machine with a GPU, 6 of the 7
tests/test_nero_simple.pytests failed on unmodifieddevelopwithRuntimeError: Expected all tensors to be on the same device, but got index is on cpu, different from other tensors on cuda:0. CI has no GPU, so it never showed up.self.devicefor training, but 8 places built the index tensors astorch.LongTensor([[...]])on the CPU (search,fit,fit_from_iterable, the two embedding getters). They now use a newNERO._index_tensorthat creates them onself.device.forwardmoves its inputs toself.device.sort_idxs.detach().numpy()(3 places) would have raisedTypeErroron a CUDA tensor right after the first fix; now.detach().cpu().numpy().metadevice and checks that the index tensors follow it. It fails if the CPU is hard-coded again.Local:
test_nero_simple8 passed with CUDA available and 8 passed withCUDA_VISIBLE_DEVICES=""; ruff clean.🤖 Generated with Claude Code