Skip to content

float-double multiplication error during phase 2 training #15

@sbgonenc

Description

@sbgonenc

Report

Hi Manu!

I hope everything is going well and thanks for the tool. I have came across an issue which might be a bug. After the model finished the training in the first phase, it threw this error during the initialization and after extracting latent topics for the second phase:

Error:

/fast/AG_Bunina/Berk/projects/scDoRI/src/scdori/_core/train_grn.py:143: RuntimeWarning: invalid value encountered in divide
  rna_tf_vals = median_cell * (rna_tf_vals / rna_tf_vals.sum(axis=1, keepdims=True))
INFO:scdori._core.train_grn:Starting GRN training

GRN Epoch 0:   0%|          | 0/2417 [00:00<?, ?it/s]
GRN Epoch 0:   0%|          | 0/2417 [00:01<?, ?it/s]
Traceback (most recent call last):
  File "/fast/AG_Bunina/Berk/projects/scDoRI/train_model.py", line 145, in <module>
    model = train_model_grn(
            ^^^^^^^^^^^^^^^^
  File "/fast/AG_Bunina/Berk/projects/scDoRI/src/scdori/_core/train_grn.py", line 465, in train_model_grn
    out = model(
          ^^^^^^
  File "/fast/AG_Bunina/Berk/envs/mamba/envs/scDoRI/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1773, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/fast/AG_Bunina/Berk/envs/mamba/envs/scDoRI/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1784, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/fast/AG_Bunina/Berk/projects/scDoRI/src/scdori/_core/models.py", line 339, in forward
    C[topic] = tf_expression_input[topic] @ G_act + tf_expression_input[topic] @ G_rep
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
RuntimeError: expected mat1 and mat2 to have the same dtype, but got: double != float

I can share the relating data and pre-trained model, when needed.

Version/OS Info:

| Package      | Version             |
| ------------ | ------------------- |
| pandas       | 2.3.1               |
| anndata      | 0.12.1              |
| torch        | 2.8.0 (2.8.0+cu128) |
| numpy        | 1.26.4              |
| scikit-learn | 1.7.1               |
| scdori       | 0.0.1               |

| Dependency        | Version     |
| ----------------- | ----------- |
| statsmodels       | 0.14.5      |
| executing         | 2.2.0       |
| asttokens         | 3.0.0       |
| scipy             | 1.15.3      |
| jupyter_client    | 8.6.3       |
| tangermeme        | 0.3.0       |
| ipython           | 9.4.0       |
| texttable         | 1.7.0       |
| tqdm              | 4.67.1      |
| ipywidgets        | 8.1.7       |
| llvmlite          | 0.44.0      |
| platformdirs      | 4.3.8       |
| traitlets         | 5.14.3      |
| pyarrow           | 14.0.2      |
| six               | 1.17.0      |
| pynndescent       | 0.5.13      |
| legacy-api-wrap   | 1.4.1       |
| jupyter_core      | 5.8.1       |
| matplotlib        | 3.10.5      |
| prompt_toolkit    | 3.0.51      |
| patsy             | 1.0.1       |
| h5py              | 3.14.0      |
| ipykernel         | 6.30.1      |
| packaging         | 25.0        |
| gtfparse          | 2.5.0       |
| triton            | 3.4.0       |
| python-dateutil   | 2.9.0.post0 |
| psutil            | 7.0.0       |
| donfig            | 0.8.1.post1 |
| Pygments          | 2.19.2      |
| comm              | 0.2.3       |
| fsspec            | 2025.7.0    |
| polars            | 0.20.31     |
| pyBigWig          | 0.3.24      |
| threadpoolctl     | 3.6.0       |
| igraph            | 0.11.9      |
| defusedxml        | 0.7.1       |
| kiwisolver        | 1.4.8       |
| mpmath            | 1.3.0       |
| pyfaidx           | 0.8.1.4     |
| pytz              | 2025.2      |
| pyzmq             | 27.0.1      |
| pure_eval         | 0.2.3       |
| scanpy            | 1.11.4      |
| seaborn           | 0.13.2      |
| jedi              | 0.19.2      |
| pillow            | 11.3.0      |
| pyparsing         | 3.2.3       |
| cffi              | 1.17.1      |
| typing_extensions | 4.14.1      |
| joblib            | 1.5.1       |
| zarr              | 3.1.1       |
| umap-learn        | 0.5.9.post2 |
| wcwidth           | 0.2.13      |
| leidenalg         | 0.10.2      |
| stack-data        | 0.6.3       |
| session-info2     | 0.2         |
| crc32c            | 2.7.1       |
| parso             | 0.8.4       |
| decorator         | 5.2.1       |
| pycparser         | 2.22        |
| setuptools        | 80.9.0      |
| natsort           | 8.4.0       |
| PyYAML            | 6.0.2       |
| numba             | 0.61.2      |
| numcodecs         | 0.16.1      |
| sympy             | 1.14.0      |
| tornado           | 6.5.1       |
| cycler            | 0.12.1      |
| debugpy           | 1.8.16      |

| Component | Info                                                                           |
| --------- | ------------------------------------------------------------------------------ |
| Python    | 3.12.11 | packaged by conda-forge | (main, Jun  4 2025, 14:45:31) [GCC 13.3.0] |
| OS        | Linux-5.14.0-427.42.1.el9_4.x86_64-x86_64-with-glibc2.34                       |
| Updated   | 2025-09-03 10:32                                                               |

Thanks again for your interest! And feel free to contact when needed!
Berk

Versions

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions