jingshuw / SAVERX

R package for transfer learning of single-cell RNA-seq denoising
29 stars 9 forks source link

KeyError: rmsprop #16

Open TJCooperIL opened 4 years ago

TJCooperIL commented 4 years ago

I'm getting this error trying to run SAVER-X. Can it be fixed?

 **Error in py_call_impl(callable, dots$args, dots$keywords) : 
  KeyError: 'rmsprop'** 
9.
stop(structure(list(message = "KeyError: 'rmsprop'", call = py_call_impl(callable, 
    dots$args, dots$keywords), cppstack = structure(list(file = "", 
    line = -1L, stack = c("/home/tjcooper/R/x86_64-pc-linux-gnu-library/4.0/reticulate/libs/reticulate.so(Rcpp::exception::exception(char const*, bool)+0x74) [0x7fb3e9008294]", 
    "/home/tjcooper/R/x86_64-pc-linux-gnu-library/4.0/reticulate/libs/reticulate.so(Rcpp::stop(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x29) [0x7fb3e8ff8a66]",  ... 
8.
train_joint at train_joint.py#95
7.
autoencode at api_pretrain.py#123
6.
api$autoencode(n_inoutnodes_human = n_human, n_inoutnodes_mouse = n_mouse, 
    shared_size = shared_size, mtx_file = mtx_file, pred_mtx_file = test_mtx_file, 
    species = model.species, nonmissing_indicator = nonmissing_indicator, 
    initial_file = pretrain_file, out_dir = out_dir, batch_size = batch_size,  ... 
5.
autoencode(x[, train.idx], python.module, main, x.test, pretrain_file, 
    nonmissing_indicator, n_human, n_mouse, shared_size, model.species, 
    out_dir, batch_size, write_output_to_tsv, verbose_sum = F, 
    verbose_fit = 0L, ...) 
4.
autoFilterCV(x, sctransfer, main, pretrain_file = pretrained.weights.file, 
    nonmissing_indicator = nonmissing_indicator, model.species = model.species, 
    out_dir = out.dir, batch_size = batch_size, write_output_to_tsv = write_output_to_tsv, 
    ...) 
3.
system.time(result <- autoFilterCV(x, sctransfer, main, pretrain_file = pretrained.weights.file, 
    nonmissing_indicator = nonmissing_indicator, model.species = model.species, 
    out_dir = out.dir, batch_size = batch_size, write_output_to_tsv = write_output_to_tsv, 
    ...)) 
2.
computePrediction(task.id, input.file.name, data.matrix, data.species, 
    use.pretrain, pretrained.weights.file, model.species, model.nodes.ID, 
    verbose = verbose, is.large.data = is.large.data, batch_size = batch_size, 
    clearup.python.session = clearup.python.session, ...) 
1.
saverx("/home/tjcooper/Documents/mouse_retina/shekhar_downsampled.csv", 
    data.species = "Mouse", use.pretrain = T, pretrained.weights.file = "/home/tjcooper/Documents/SAVERX_pretrained_weights/mouse_Retina.hdf5", 
    model.species = "Mouse") 

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
[1] en_IL.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] SAVERX_1.0.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5         rstudioapi_0.11    magrittr_1.5       rappdirs_0.3.1     tidyselect_1.1.0   munsell_0.5.0      cowplot_1.0.0      colorspace_1.4-1   lattice_0.20-41    R6_2.4.1           rlang_0.4.7        dplyr_1.0.0       
[13] tools_4.0.2        grid_4.0.2         gtable_0.3.0       ellipsis_0.3.1     tibble_3.0.3       lifecycle_0.2.0    crayon_1.3.4       Matrix_1.2-18      purrr_0.3.4        RColorBrewer_1.1-2 ggplot2_3.3.2      vctrs_0.3.2       
[25] glue_1.4.1         compiler_4.0.2     pillar_1.4.6       generics_0.0.2     scales_1.1.1       jsonlite_1.7.0     reticulate_1.16    pkgconfig_2.0.3   
Weights loaded from /home/tjcooper/Documents/SAVERX_pretrained_weights/mouse_Retina.hdf5!
//usr/local/lib/python3.8/dist-packages/scanpy/api/__init__.py:3: FutureWarning: 

In a future version of Scanpy, `scanpy.api` will be removed.
Simply use `import scanpy as sc` and `import scanpy.external as sce` instead.

  warnings.warn(
TJCooperIL commented 3 years ago

Adding detail:

Error in py_call_impl(callable, dots$args, dots$keywords) : 
  KeyError: 'rmsprop'

Detailed traceback: 
  File "//usr/local/lib/python3.8/dist-packages/sctransfer/api.py", line 84, in autoencode
    loss = train(adata[adata.obs.DCA_split == 'train'],
  File "//usr/local/lib/python3.8/dist-packages/sctransfer/train.py", line 46, in train
    optimizer = opt.__dict__[optimizer](clipvalue=clip_grad)
Timing stopped at: 1.494 0.035 1.501
clay001 commented 3 years ago

Adding detail:

Error in py_call_impl(callable, dots$args, dots$keywords) : 
  KeyError: 'rmsprop'

Detailed traceback: 
  File "//usr/local/lib/python3.8/dist-packages/sctransfer/api.py", line 84, in autoencode
    loss = train(adata[adata.obs.DCA_split == 'train'],
  File "//usr/local/lib/python3.8/dist-packages/sctransfer/train.py", line 46, in train
    optimizer = opt.__dict__[optimizer](clipvalue=clip_grad)
Timing stopped at: 1.494 0.035 1.501

have you resolved it yet? or did they respond you? I met the same question when using the web server and the same R package key error: 'rmsprop', then what could I do to use to denoise my data?

jingshuw commented 3 years ago

Hi,

I have never encountered such an error before and will look into it. Will you encounter the same error if you use our sampled data provided for demo?

Jingshu

clay001 commented 3 years ago

Hi,

I have never encountered such an error before and will look into it. Will you encounter the same error if you use our sampled data provided for demo?

Jingshu

Yes, my operating system is Win10, I used the Lamanno's dataset and also failed in file <- saverx("./testdata/shekhar_downsampled.csv") line, lots of cuda warning and again keyerror, I guess it may because the tensorflow version and cuda version. And then I ran it in Mac OS, crashed. May due to memorry thing.

Conclusion, I think it is because the environment setting. Now I ran it in a well-setting previous version, it can work.

TJCooperIL commented 3 years ago

Running it on the provided sample data yields the same error. I'm running Ubuntu 20.04, R 4.0.2. It may indeed be an issue with package versions - but it would be good to know which exact packages are required.

lbl233 commented 3 years ago

Hi, I have never encountered such an error before and will look into it. Will you encounter the same error if you use our sampled data provided for demo? Jingshu

Yes, my operating system is Win10, I used the Lamanno's dataset and also failed in file <- saverx("./testdata/shekhar_downsampled.csv") line, lots of cuda warning and again keyerror, I guess it may because the tensorflow version and cuda version. And then I ran it in Mac OS, crashed. May due to memorry thing.

Conclusion, I think it is because the environment setting. Now I ran it in a well-setting previous version, it can work.

Hi, I encounter the same problems. Could you please tell me which version can work? Thanks

ansonrel commented 3 years ago

Hi,

I'm having the same issue with sctransfer v0.0.9 and SAVERX v1.0.0. I 've tried with different versions of sctransfer/ SAVERX and even tensorflow, but I still have this error message. Is there somewhere a list of package versions that work ?

ayoublasri commented 3 years ago

Hi, I have the same error, any luck?

Msturroc commented 3 years ago

Hi there, I am also having the same issue. Can this be amended? Or can a list of package requirements that work be suggested?

ansonrel commented 3 years ago

A temporary solution can be to use this list. It doesn't have the latest versions of sctransfer/ SAVERX and it lists many packages that are not important here but it's working on my side.

(for people not used to Python/pip) Put the output of pip3 freeze in a requirements.txt file and run pip install -r requirements.txt. You may have errors due to unnecessary packages, then just delete the corresponding packages from the list.

ayoublasri commented 3 years ago

Thanks @ansonrel! Worked for me 🥳

alikhuseynov commented 3 years ago

Hi guys, I think the problem is tensorflow 2.x.x. sctransfer==0.0.9 has python code modifications for that, however it gives the same error you mentioned KeyError: 'rmsprop' so, using sctransfer==0.0.5solved the issue in my case, but you need to downgrade the following libs:

pip install sctransfer==0.0.5
pip install keras==2.2.5.0
pip install tensorflow==1.15
pip install tensorflow-gpu==1.15
pip install scanpy==1.5.1
pip install anndata==0.7.3