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

CellCharter on single sample from Xenium #59

Open
jnmark opened this issue Nov 20, 2024 · 3 comments
Open

CellCharter on single sample from Xenium #59

jnmark opened this issue Nov 20, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@jnmark
Copy link

jnmark commented Nov 20, 2024

Report

I am trying to run CellCharter on a single sample, and I get the following error during the model train process: model.train(early_stopping=True, enable_progress_bar=True)

ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 128])

Prior to this, I setup the model as follows:

scvi.settings.seed = 12345
scvi.model.SCVI.setup_anndata(
    adata=adata_xenium,
    layer="raw"
)

model = scvi.model.SCVI(adata_xenium)

Here is the session info:

-----
anndata             0.10.8
cellcharter         0.3.2
matplotlib          3.7.1
numpy               1.26.0
pandas              2.2.2
scanpy              1.9.3
scvi                1.1.6.post2
session_info        1.0.0
squidpy             1.6.1
-----
PIL                         10.2.0
absl                        NA
affine                      2.4.0
anyio                       NA
arrow                       1.3.0
asciitree                   NA
asttokens                   NA
attr                        23.2.0
attrs                       23.2.0
babel                       2.16.0
cairo                       1.20.1
certifi                     2024.02.02
cffi                        1.17.1
chardet                     4.0.0
charset_normalizer          3.3.2
chex                        0.1.87
click                       8.1.7
cloudpickle                 3.0.0
comm                        0.2.2
contextlib2                 NA
cycler                      0.12.1
cython_runtime              NA
dask                        2024.7.1
dask_expr                   1.1.9
dask_image                  2023.08.1
datashader                  0.16.3
datatree                    0.0.15
dateutil                    2.8.2
debugpy                     1.8.1
decorator                   4.4.2
defusedxml                  0.7.1
docrep                      0.3.2
etils                       1.5.2
exceptiongroup              1.2.1
executing                   2.0.1
fastjsonschema              NA
filelock                    3.12.2
flax                        0.8.5
fqdn                        NA
fsspec                      2023.6.0
geopandas                   0.14.3
gi                          3.40.1
gio                         NA
glib                        NA
gobject                     NA
gtk                         NA
h5py                        3.10.0
idna                        2.10
igraph                      0.11.4
imagecodecs                 2024.1.1
imageio                     2.34.0
importlib_metadata          NA
importlib_resources         NA
ipykernel                   6.29.4
isoduration                 NA
jax                         0.4.30
jaxlib                      0.4.30
jedi                        0.19.1
jinja2                      3.1.3
joblib                      1.3.2
json5                       0.9.25
jsonpointer                 2.0
jsonschema                  4.21.1
jsonschema_specifications   NA
jupyter_events              0.10.0
jupyter_server              2.14.2
jupyterlab_server           2.27.3
kiwisolver                  1.4.5
lazy_loader                 NA
leidenalg                   0.10.2
lightning                   2.4.0
lightning_fabric            2.4.0
lightning_utilities         0.11.8
llvmlite                    0.42.0
markupsafe                  2.1.5
matplotlib_inline           0.1.7
matplotlib_scalebar         0.8.1
ml_collections              NA
ml_dtypes                   0.5.0
mpl_toolkits                NA
mpmath                      1.3.0
msgpack                     1.0.8
mudata                      0.2.4
multipledispatch            0.6.0
multiscale_spatial_image    1.0.1
natsort                     8.4.0
nbformat                    5.10.4
netifaces                   0.10.6
networkx                    3.2.1
numba                       0.59.1
numcodecs                   0.12.1
numpydoc                    1.7.0
numpyro                     0.15.3
ome_zarr                    NA
opt_einsum                  3.4.0
optax                       0.2.3
overrides                   NA
packaging                   23.2
param                       2.1.1
parso                       0.8.4
patsy                       0.5.6
pexpect                     4.8.0
pkg_resources               NA
platformdirs                3.10.0
pooch                       v1.8.1
prometheus_client           NA
prompt_toolkit              3.0.43
psutil                      5.8.0
ptyprocess                  0.6.0
pure_eval                   0.2.2
pyarrow                     16.0.0
pycparser                   2.22
pyct                        0.5.0
pydev_ipython               NA
pydevconsole                NA
pydevd                      2.9.5
pydevd_file_utils           NA
pydevd_plugins              NA
pydevd_tracing              NA
pygments                    2.17.2
pyparsing                   2.4.7
pyproj                      3.6.1
pyro                        1.9.1
pythonjsonlogger            NA
pytorch_lightning           2.4.0
pytz                        2021.1
rasterio                    1.4.2
referencing                 NA
requests                    2.32.3
rfc3339_validator           0.1.4
rfc3986_validator           0.1.1
rich                        NA
rpds                        NA
scipy                       1.10.1
seaborn                     0.13.2
send2trash                  NA
setuptools                  53.0.0
shapely                     2.0.3
six                         1.15.0
skimage                     0.22.0
sklearn                     1.4.1.post1
sknw                        0.1
sniffio                     1.3.1
socks                       1.7.1
spatial_image               1.1.0
spatialdata                 0.2.5.post0
spatialdata_plot            0.2.7
sphinxcontrib               NA
stack_data                  0.6.3
statsmodels                 0.14.0
sympy                       1.13.1
tblib                       3.0.0
texttable                   1.7.0
threadpoolctl               3.3.0
tifffile                    2024.2.12
tlz                         0.12.1
toolz                       0.12.1
torch                       2.5.1+cu124
torchgen                    NA
torchgmm                    NA
torchmetrics                1.6.0
tornado                     6.4
tqdm                        4.66.2
traitlets                   5.14.3
triton                      3.1.0
typing_extensions           NA
uri_template                NA
urllib3                     1.26.5
validators                  0.22.0
wcwidth                     0.2.13
webcolors                   24.8.0
websocket                   1.8.0
xarray                      2023.12.0
xarray_dataclasses          1.8.0
xarray_schema               0.0.3
xrspatial                   0.4.0
yaml                        5.4.1
zarr                        2.17.0
zipp                        NA
zmq                         26.0.2
zoneinfo                    NA
-----
IPython             8.18.1
jupyter_client      8.6.1
jupyter_core        5.7.2
jupyterlab          4.2.5
-----
Python 3.9.16 (main, May 29 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)]
Linux-5.14.0-284.30.1.el9_2.x86_64-x86_64-with-glibc2.34
-----
Session information updated at 2024-11-20 14:29

Version information

0.3.2

@jnmark jnmark added the bug Something isn't working label Nov 20, 2024
@marcovarrone
Copy link
Collaborator

marcovarrone commented Nov 21, 2024

Hi @jnmark, that's weird, it looks like if you have only one cell (or one gene) in your dataset.
Can you show me the result of print(adata_xenium)?

@jnmark
Copy link
Author

jnmark commented Nov 22, 2024

Hi @marcovarrone, I agree, I found it quite strange too, and I did infact first make sure there was no issue with my anndata object. I have ~100k+ cells and ~5k genes in my object. Here is my output of print(adata_xenium):
Screenshot 2024-11-22 at 9 53 01 AM

@marcovarrone
Copy link
Collaborator

Since the error is happening during the training of scvi you can try writing an issue in their GitHub repository.

By looking at the scVI issues, I have seen that this error tends to appear when the number of cells is such that the last batch has size 1. You can see here.
It doesn't llook to be your case because 172943%128 is 15, so the last batch would have 15 elements. Still, you could try to change the batch size.

Does adata_xenium.layers['raw'] look fine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants