snap-stanford / SATURN

MIT License
108 stars 17 forks source link

train-saturn.py: error: unrecognized arguments: \ #6

Closed MohammedZidane closed 1 year ago

MohammedZidane commented 1 year ago

Hi, I installed saturn according to the instructions (my pytorch version is 2.0.0+cu117). I ran Train SATURN.ipynb file in Vignettes/frog_zebrafish_embryogenesis/

But got this

Global seed set to 0 Intel(R) Extension for Scikit-learn* enabled (https://github.com/intel/scikit-learn-intelex) usage: train-saturn.py [-h] [--in_data IN_DATA] [--device DEVICE] [--device_num DEVICE_NUM] [--time_stamp TIME_STAMP] [--org ORG] [--log_dir LOG_DIR] [--work_dir WORK_DIR] [--seed SEED] [--in_label_col IN_LABEL_COL] [--ref_label_col REF_LABEL_COL] [--tissue_subset TISSUE_SUBSET] [--tissue_column TISSUE_COLUMN] [--hv_genes HV_GENES] [--hv_span HV_SPAN] [--num_macrogenes NUM_MACROGENES] [--centroids_init_path CENTROIDS_INIT_PATH] [--embedding_model {ESM1b,MSA1b,protXL,ESM1b_protref,ESM2}] [--vae [VAE]] [--hidden_dim HIDDEN_DIM] [--model_dim MODEL_DIM] [--binarize_expression [BINARIZE_EXPRESSION]] [--scale_expression [SCALE_EXPRESSION]] [--pretrain [PRETRAIN]] [--pretrain_model_path PRETRAIN_MODEL_PATH] [--pretrain_lr PRETRAIN_LR] [--pretrain_batch_size PRETRAIN_BATCH_SIZE] [--l1_penalty L1_PENALTY] [--pe_sim_penalty PE_SIM_PENALTY] [--pretrain_epochs PRETRAIN_EPOCHS] [--unfreeze_macrogenes [UNFREEZE_MACROGENES]] [--mnn [MNN]] [--use_ref_labels [USE_REF_LABELS]] [--batch_size BATCH_SIZE] [--metric_lr METRIC_LR] [--epochs EPOCHS] [--balance_pretrain [BALANCE_PRETRAIN]] [--equalize_triplets_species [EQUALIZE_TRIPLETS_SPECIES]] [--balance_species_cells [BALANCE_SPECIES_CELLS]] [--non_species_batch_col NON_SPECIES_BATCH_COL] [--polling_freq POLLING_FREQ] [--score_adatas [SCORE_ADATAS]] [--ct_map_path CT_MAP_PATH] [--score_ref_labels [SCORE_REF_LABELS]] train-saturn.py: error: unrecognized arguments: \

Could you help? Thanks

Yanay1 commented 1 year ago

I can't reproduce the error unfortunately. You can try removing all those characters and moving all the arguments to one line, eg:

python3 ../../train-saturn.py --in_data=data/frog_zebrafish_run.csv --in_label_col=cell_type --ref_label_col=cell_type --num_macrogenes=2000     --hv_genes=8000   --centroids_init_path=saturn_results/fz_centroids.pkl  --score_adata --ct_map_path=data/frog_zebrafish_cell_type_map.csv --work_dir=.  --device_num=7 
MohammedZidane commented 1 year ago

Thanks for your reply. Unfortunately, it did not work and got this error

Global seed set to 0 Intel(R) Extension for Scikit-learn* enabled (https://github.com/intel/scikit-learn-intelex) Traceback (most recent call last): File "/home/mohammed/SATURN/Vignettes/frog_zebrafish_embryogenesis/../../train-saturn.py", line 1042, in torch.cuda.set_device(args.device_num) File "/home/mohammed/.local/lib/python3.10/site-packages/torch/cuda/init.py", line 350, in set_device torch._C._cuda_setDevice(device) RuntimeError: CUDA error: invalid device ordinal Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

Note: I added '!' before the line you sent me

Thanks

Yanay1 commented 1 year ago

Make sure to change the device_num argument to the number corresponding to the GPU you want to use.

MohammedZidane commented 1 year ago

Thanks. It worked! Just to understand how the first error was fixed. You suggested writing the command as one line. Could you share with me what the difference is between writing it as one line or as it was originally? I appreciate your help, thank you very much:)

Yanay1 commented 1 year ago

As it was written originally, it had backslashes which should make the command be interpreted as a single line even though it was written across many, but it seemed like it didn't, so just explicitly writing it as a single line would fix it.