I encountered a CUDA Out of Memory error when running the script get_embedding.py with a small dataset containing 2 rows.
Below are the details of the error and the command used to run the script.
Also what is your suggested environment for running scFoundation? how much GPU capacity is recommended?
Command Used:
sbatch test.3.sh /home/sbnb/ddalton/projects/scFoundation/model/get_embedding.py --task_name SCAD_bulk_Etoposide --input_type bulk --output_type cell --pool_type all --tgthighres f1 --data_path X_df_sample.csv --save_path ./ --pre_normalized F --version ce --demoX_df_sample.csv contains the same data asX_df.csvbut with only 2 rows.
Error Log:
Traceback (most recent call last):
File "/home/sbnb/ddalton/projects/scFoundation/model/get_embedding.py", line 305, in <module>
main()
File "/home/sbnb/ddalton/projects/scFoundation/model/get_embedding.py", line 232, in main
geneemb = pretrainmodel.encoder(x,x_padding)
File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/sbnb/ddalton/projects/scFoundation/model/pretrainmodels/transformer.py", line 42, in forward
x = mod(x, src_key_padding_mask=padding_mask) # , src_mask=mask, src_key_padding_mask=src_key_padding_mask)
File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/transformer.py", line 506, in forward
return torch._transformer_encoder_layer_fwd(
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 10.45 GiB (GPU 0; 23.69 GiB total capacity; 21.57 GiB already allocated; 980.06 MiB free; 21.62 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF`
Memory Tracking
I also tracked memory usage with this function:
Hi,
The GPU memory required by scFoundation depends on the sparsity of the cell expression vector, not on the number of cells. We recommend using A100 40G or 80G for local inference.
I encountered a CUDA Out of Memory error when running the script
get_embedding.py
with a small dataset containing 2 rows. Below are the details of the error and the command used to run the script.Also what is your suggested environment for running scFoundation? how much GPU capacity is recommended?
Command Used:
sbatch test.3.sh /home/sbnb/ddalton/projects/scFoundation/model/get_embedding.py --task_name SCAD_bulk_Etoposide --input_type bulk --output_type cell --pool_type all --tgthighres f1 --data_path X_df_sample.csv --save_path ./ --pre_normalized F --version ce --demo
X_df_sample.csv
contains the same data asX_df.csv
but with only 2 rows. Error Log:Memory Tracking I also tracked memory usage with this function:
At various steps in the
get_embeddings.py
script - jsut beforegeneemb = pretrainmodel.encoder(x,x_padding)
:With the following output:
Environment Details PyTorch version: 1.13.1+cu117 CUDA version: 11.7 GPU: 24 GB total capacity
Thanks in advance!