andreariba / DeepCycle

Cell cycle inference in single-cell RNA-seq
https://www.nature.com/articles/s41467-022-30545-8
GNU General Public License v3.0
38 stars 7 forks source link

object of type 'BatchDataset' has no len() #15

Closed Pinolinoo closed 1 year ago

Pinolinoo commented 1 year ago

hello,

thank you for this very nice program I enjoyed reading the paper! I tried to use it on my own data aswell as on the data from the paper and both times I get the following error:

2023-04-24 16:42:51.699538: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1 2023-04-24 16:42:51.796486: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: pciBusID: 0000:12:00.0 name: NVIDIA A40 computeCapability: 8.6 coreClock: 1.74GHz coreCount: 84 deviceMemorySize: 44.42GiB deviceMemoryBandwidth: 648.29GiB/s 2023-04-24 16:42:51.798017: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 2023-04-24 16:42:51.802005: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10 2023-04-24 16:42:51.805272: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10 2023-04-24 16:42:51.806779: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10 2023-04-24 16:42:51.810233: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10 2023-04-24 16:42:51.812378: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10 2023-04-24 16:42:51.818265: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7 2023-04-24 16:42:51.821573: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0 2023-04-24 16:43:08.225185: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA 2023-04-24 16:43:08.239525: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 2500000000 Hz 2023-04-24 16:43:08.239772: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x562c3cf956e0 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2023-04-24 16:43:08.239819: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version 2023-04-24 16:43:08.243390: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: pciBusID: 0000:12:00.0 name: NVIDIA A40 computeCapability: 8.6 coreClock: 1.74GHz coreCount: 84 deviceMemorySize: 44.42GiB deviceMemoryBandwidth: 648.29GiB/s 2023-04-24 16:43:08.243493: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 2023-04-24 16:43:08.243526: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10 2023-04-24 16:43:08.243554: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10 2023-04-24 16:43:08.243582: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10 2023-04-24 16:43:08.243610: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10 2023-04-24 16:43:08.243637: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10 2023-04-24 16:43:08.243665: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7 2023-04-24 16:43:08.247679: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0 2023-04-24 16:43:08.247766: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1 2023-04-24 16:43:08.376004: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix: 2023-04-24 16:43:08.376080: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108] 0 2023-04-24 16:43:08.377530: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0: N 2023-04-24 16:43:08.379774: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1247] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 42506 MB memory) -> physical GPU (device: 0, name: NVIDIA A40, pci bus id: 0000:12:00.0, compute capability: 8.6) 2023-04-24 16:43:08.382022: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x562c3ea51f40 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices: 2023-04-24 16:43:08.382055: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): NVIDIA A40, Compute Capability 8.6 Traceback (most recent call last): File "DeepCycle.py", line 418, in <module> n_batches_to_validation = math.ceil(len(e_dataset)*fraction_of_cells_to_validation) TypeError: object of type 'BatchDataset' has no len()

The command i used was:

~/miniconda3/envs/DeepCycle/bin/python DeepCycle.py \ --input_adata /fast/AG_Metzger/philipp/python_files/daughtercellmatcher/DeepCycle/data/velocity_anndata_human_fibroblast_DeepCycle_ISMARA.h5ad \ --gene_list /fast/AG_Metzger/philipp/python_files/daughtercellmatcher/DeepCycle/data/GO_cell_cycle_annotation_human.txt \ --base_gene AAAS \ --expression_threshold 1 \ --gpu \ --output_adata /fast/AG_Metzger/philipp/python_files/daughtercellmatcher/DeepCycle/data/mousebrain_output_deepcycle.h5ad

I apprciate your help,

Philipp

augustinas1 commented 1 year ago

Hi, this is a duplicate of issue #12 . Could you try either changing the corresponding line 418 in DeepCycle.py to n_batches_to_validation = math.ceil(tf.data.experimental.cardinality(e_dataset).numpy() * fraction_of_cells_to_validation) or updating tensorflow to the most recent version?

Pinolinoo commented 1 year ago

thank you! Replacing the line worked!