Error in py_call_impl(callable, call_args$unnamed, call_args$named)
liuzhuoliang123 opened this issue · 2 comments
Hi,
When I use scvi in R, errors occur when I set the parameters as follows; however, when I cancel these parameter settings and use the default parameters, the errors disappear. How can I resolve this issue?
model = scvi$model$SCVI(adata, gene_likelihood = "nb", n_latent = 50, n_layers = 2)
Show Traceback Rerun with Debug
Error in py_call_impl(callable, call_args$unnamed, call_args$named) :
TypeError: can't multiply sequence by non-int of type 'float' Runreticulate::py_last_error()
for details.
reticulate::py_last_error()
── Python Exception Message ──────────────────────────────────────────────────────────────────────────────
Traceback (most recent call last):
File "/home/data/t170403/miniconda3/envs/scvi/lib/python3.9/site-packages/scvi/model/_scvi.py", line 158, in init self.module = self._module_cls(
File "/home/data/t170403/miniconda3/envs/scvi/lib/python3.9/site-packages/scvi/module/_vae.py", line 175, in init self.z_encoder = Encoder(
File "/home/data/t170403/miniconda3/envs/scvi/lib/python3.9/site-packages/scvi/nn/_base_components.py", line 239, in init self.encoder = FCLayers(
File "/home/data/t170403/miniconda3/envs/scvi/lib/python3.9/site-packages/scvi/nn/_base_components.py", line 67, in init layers_dim = [n_in] + (n_layers - 1) * [n_hidden] + [n_out]
TypeError: can't multiply sequence by non-int of type 'float'
── R Traceback ───────────────────────────────────────────────────────────────────────────────────────────
▆ 1. └─scvi$model$SCVI(...)
- └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named) See
reticulate::py_last_error()$r_trace$full_call
for more details.
This look to me like n_layers=2 is interpreted as a float value. Can you remove the optional argument? To cast a value as an integer in R my understanding is that you need to explicitly call: as.integer(2)
This look to me like n_layers=2 is interpreted as a float value. Can you remove the optional argument? To cast a value as an integer in R my understanding is that you need to explicitly call: as.integer(2)
Yes, that's correct. I made the modifications according to the method you described, and it is now running successfully with the error resolved! I am very grateful for your response!