Repository navigation
Conversation
With tabpfn>=9.1 the regressor's logits and criterion live on the model device, so sampled values were on CUDA while the table being imputed is on the CPU. Assigning them raised 'Expected all tensors to be on the same device'. Move them with .to(device=impute_X.device, dtype=...) in both impute_ and impute_single_permutation_. Fixes PriorLabs#420 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Fixes #420.
Problem
TabPFNUnsupervisedModel.generate_synthetic_data()andimpute()crash on a CUDA machine withExpected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!. The table being filled (impute_X) is on the CPU, but since tabpfn 9.1 the regressor's logits and criterion are returned on the model's device, so the sampled values are on the GPU. The assignment only did.to(y_predict.dtype), which changes the dtype but not the device.Change
Use
.to(device=impute_X.device, dtype=y_predict.dtype)at both assignment sites (impute_andimpute_single_permutation_). The values already live in a CPU table, so this is a no-op on CPU-only setups.Testing
test_impute_single_permutation_moves_samples_to_input_device. It needs no model weights or GPU: it stubs the sampling step with a tensor that records the arguments passed to.to. It fails before this change and passes after.ruffis clean for the lines I touched (3 pre-existing warnings remain in the test file).🤖 Generated with Claude Code