GPU requirements
Hello, sorry to jump again in here
I am trying to finetune the model to classify cells (Cell classifier) on my personal PC with a GPU of 6GB
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 573.44 Driver Version: 573.44 CUDA Version: 12.8 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Driver-Model | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA RTX 1000 Ada Gene... WDDM | 00000000:01:00.0 Off | N/A |
| N/A 61C P4 13W / 30W | 0MiB / 6141MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
This is the code i am using
´´´
from geneformer import Classifier
from pathlib import Path
token_dir = Path("tokenized_files/singlecell_4096_clean.dataset")
prepared_dir = Path("training_dataset")
results_dir = Path("results_classification")
cc = Classifier(
classifier='cell',
cell_state_dict={'state_key': 'cell_ontology_class', 'states': 'all'},
filter_data={},
max_ncells_per_class=300,
max_ncells=50_000,
freeze_layers=2,
num_crossval_splits=1,
#split_sizes={'train':0.7, 'valid':0.15, 'test':0.15},
stratify_splits_col='donor',
nproc=4,
forward_batch_size = 1,
model_version="V2",
quantize=True
)
cc.prepare_data(
#attr_to_split='donor',
attr_to_balance=['tissue', 'sex', 'age'],
input_data_file=str(token_dir),
output_directory=str(prepared_dir),
output_prefix='singlecell_type',
test_size=0.15
)
´´´
but then when i run
all_metrics = cc.validate(model_directory="../../Geneformer/Geneformer-V2-104M",
prepared_input_data_file=f"training_dataset/singlecell_type_labeled_train.dataset",
id_class_dict_file=f"training_dataset/singlecell_type_id_class_dict.pkl",
output_directory="results_classification",
output_prefix="first_trial",
predict_eval=True)
it gives the output
0%| | 0/1 [00:00<?, ?it/s]****** Validation split: 1/1 ******
The Kernel crashed while executing code in the current cell or a previous cell.
Please review the code in the cell(s) to identify a possible cause of the failure.
Click here for more info.
View Jupyter log for further details.
11:41:54.411 [error] Disposing session as kernel process died ExitCode: 3221225477, Reason: The syntax of the command is incorrect.
The syntax of the command is incorrect.
I do not know if the GPU went out of memory or not. and if that is the case, would using the quantized option help? would there be a way to do with a GPU of 16GB (that i have on a server), or that is still not enough?
Thanks for the help!
Thank you for your question - yes the quantization should help reduce memory. You could try profiling the memory to check whether it’s running out of memory. The original 30M model is also smaller so would take less memory. Another option is freezing more layers to save memory, but this could have a negative impact on the model training. The tutorial linked in the model card uses Google Colab for reference - you could access larger GPUs on Colab as well with credits if needed.