Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensor Nan Error #65

Closed
frankchen121212 opened this issue May 31, 2022 · 3 comments
Closed

Tensor Nan Error #65

frankchen121212 opened this issue May 31, 2022 · 3 comments

Comments

@frankchen121212
Copy link

Hello, thank you for the great work, I'm trying to run DestVI on other datasets, and I've transformed all the data into h5ad format with all necessary values to train the model,

I'm following DestVI_tutorial.ipynb to run the training in order to get the cell type composition matrix

My input singlecell data:
AnnData object with n_obs × n_vars = 1691 × 19972
obs: 'cell_types'
My input ST data:
AnnData object with n_obs × n_vars = 3067 × 135
obsm: 'location'

However, when training the sc model, the following error occurred:

ValueError: Expected parameter loc (Tensor of shape (128, 5)) of distribution Normal(loc: torch.Size([128, 5]), scale: torch.Size([128, 5])) to satisfy the constraint Real(), but found invalid values:
tensor([[nan, nan, nan, nan, nan],
        nan, nan, nan, nan, nan],
        [nan, nan, nan, nan, nan]], device='cuda:0', grad_fn=<AddmmBackward0>)

Have you faced with similar error before? Hoping that you can help me, thank you so much!

@canergen
Copy link
Member

Please open this in our discourse forum https://discourse.scverse.org. It most likely has to do with your input data and is related to training scvi. scvi expects unnormalized/unscaled raw counts as input and you should do filtering for min_counts. Please report with it np.max(data.X),np.min(data.X), np.all(np.isfinite(data.X)), np.min(data.X.sum(1)).

@QiaolinLu
Copy link

Hello, thank you for the great work, I'm trying to run DestVI on other datasets, and I've transformed all the data into h5ad format with all necessary values to train the model,

I'm following DestVI_tutorial.ipynb to run the training in order to get the cell type composition matrix

My input singlecell data: AnnData object with n_obs × n_vars = 1691 × 19972 obs: 'cell_types' My input ST data: AnnData object with n_obs × n_vars = 3067 × 135 obsm: 'location'

However, when training the sc model, the following error occurred:

ValueError: Expected parameter loc (Tensor of shape (128, 5)) of distribution Normal(loc: torch.Size([128, 5]), scale: torch.Size([128, 5])) to satisfy the constraint Real(), but found invalid values:
tensor([[nan, nan, nan, nan, nan],
        nan, nan, nan, nan, nan],
        [nan, nan, nan, nan, nan]], device='cuda:0', grad_fn=<AddmmBackward0>)

Have you faced with similar error before? Hoping that you can help me, thank you so much!

yeah, it works fine in CondSCVI, but it runs with ValueError in DestVI training. I try to change the learning rate, to use raw data input or log-normalized data input, the bug remains.
Have you solved the error? I really hope that you can help me, thank you!

@izabellaleahz
Copy link

I am also having the same issue, any insight on how to fix this bug would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants