gifford-lab / prescient

Codebase for PRESCIENT (Potential eneRgy undErlying Single Cell gradIENTs) for generative modeling of single-cell time-series.
MIT License
44 stars 7 forks source link

Error in training #5

Closed YangLi-Bio closed 2 years ago

YangLi-Bio commented 2 years ago

Dear authors,

I have succeeded in preprocessing the data using Prescient, but when I tried to train the model by: prescient train_model -i $outDir/data.pt --out_dir $expDir --weight_name 'kegg-growth' --gpu 0 \ --pretrain_epochs 10 --train_epochs 10 --seed 3 --layers 2 --k_dim 200 --train_tau 1e-06

I obtained the following error: _Traceback (most recent call last): File "/users/PAS1475/liyang/.conda/envs/GLUE_env/bin/prescient", line 8, in sys.exit(main()) File "/users/PAS1475/liyang/.conda/envs/GLUE_env/lib/python3.9/site-packages/prescient/main.py", line 18, in main cmd.main(args) File "/users/PAS1475/liyang/.conda/envs/GLUE_env/lib/python3.9/site-packages/prescient/commands/train_model.py", line 151, in main train.run(args, train_init) File "/users/PAS1475/liyang/.conda/envs/GLUE_env/lib/python3.9/site-packages/prescient/train/run.py", line 62, in run x_last = x[config.traint[-1]].to(device) # use the last available training point IndexError: list index out of range

Could you please help me to figure out this issue?

YangLi-Bio commented 2 years ago

I have printed the values of len(x), y, w, and config.train_t as follows:

  1. x = 3
  2. y = [2, 5, 13]
  3. w = {}
  4. config.train_t = [5, 13]

The last element of config.train_t is 13, which is larger than the length of x. That is the source of this error.

Could you please help check this?

Thank you!

ghost commented 2 years ago

I've ran into the exact same issue, and yet I am not perfectly sure this is the correct way to do it, but I just replaced all my time point metadata from y=[0,3,10,28] representing days to y=[0,1,2,3] and just treated them as categorical data with order. It seems to do the trick.

YangLi-Bio commented 2 years ago

I've ran into the exact same issue, and yet I am not perfectly sure this is the correct way to do it, but I just replaced all my time point metadata from y=[0,3,10,28] representing days to y=[0,1,2,3] and just treated them as categorical data with order. It seems to do the trick.

Thank you very much! At present, I might try your suggestion.

sachitsaksena commented 2 years ago

Hi all, apologies for the delayed response. @sylash92 thank you very much for providing your solution!

@sylash92's suggestion is my recommendation as well, as our current implementation requires these sequential categorical labels of time series for indexing. @YangLi-Bio did this solve your problem?

YangLi-Bio commented 2 years ago

Hi all, apologies for the delayed response. @sylash92 thank you very much for providing your solution!

@sylash92's suggestion is my recommendation as well, as our current implementation requires these sequential categorical labels of time series for indexing. @YangLi-Bio did this solve your problem?

Hi Sachitsaksena,

Thanks for your response. I tried Sylash's method and succeeded. My issue has been solved. Please close it.

Best regards,