-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I am running cell2location with torch version: 2.7.1+cu126.
- I have confirmed this bug exists on the latest version of cell2location. See https://github.com/BayraktarLab/cell2location#installation
- I follow the instructions from the scvi-tools tutorial.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Minimal code sample (that we can run without your data, using public data)
# Your code here
adata_ref = sc.read_h5ad(f"{path_to_data}")
adata_ref.X = adata_ref.raw.X
selected = filter_genes(adata_ref, cell_count_cutoff=5, cell_percentage_cutoff2=0.03, nonz_mean_cutoff=1.12)
adata_ref = adata_ref[:, selected].copy()
adata_ref.X = adata_ref.X.astype("int")
cell2location.models.RegressionModel.setup_anndata(adata=adata_ref,
# 10X reaction / sample / batch
batch_key='donor_id',
# cell type, covariate used for constructing signatures
labels_key='cell_type_final',
categorical_covariate_keys=None,
continuous_covariate_keys=None)
# create the regression model
from cell2location.models import RegressionModel
mod = RegressionModel(adata_ref)
# Use all data for training (validation not implemented yet, train_size=1)
mod.train(max_epochs=250, # If None, defaults to np.min([round((20000 / n_cells) * 400), 400])
batch_size=250,
train_size=1, # proportion of cells in the training set (for cross-validation)
lr=0.002) #max_epochs=250ValueError: at site "data_target", invalid log_prob shape
Expected [250, -1], actual [250, 250, 15245]
Try one of the following fixes:
- enclose the batched tensor in a with pyro.plate(...): context
- .to_event(...) the distribution being sampled
- .permute() data dimensions
[Paste the error output produced by the above code here]Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working