# Getting the parameters and their names of scVI

**URL:** <https://discourse.scverse.org/t/getting-the-parameters-and-their-names-of-scvi/815>\
**Category:** scvi-tools\
**Tags:** scvi\
**Created:** [October 11, 2022, 7:31am UTC](https://discourse.scverse.org/t/getting-the-parameters-and-their-names-of-scvi/815 "2022-10-11T07:31:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zidane](https://avatars.discourse-cdn.com/v4/letter/z/58956e/32.png) [@Zidane](https://discourse.scverse.org/u/Zidane)\
**Post date:** [October 11, 2022, 7:31am UTC](https://discourse.scverse.org/t/getting-the-parameters-and-their-names-of-scvi/815/1 "2022-10-11T07:31:16Z")

</div>

Hi,  
I used to use model.named\_parameters in pytorch to get the model’s parameters and their names. I found the analogous in scvi

scvi.module.SCANVAE.named\_parameters

but I could not understand the provided example

for name, param in self.named\_parameters():  
if name in [‘bias’]:  
print(param.size())

I am not sure how to use it to get the parameters of the scVI model I am using. For example, I am calling the scVI model ‘MODEL’. How can I get the ‘MODEL’ parameters and their names?

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![adamgayoso](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/adamgayoso/32/100_2.png) [@adamgayoso](https://discourse.scverse.org/u/adamgayoso)\
**Post date:** [December 10, 2022, 3:06am UTC](https://discourse.scverse.org/t/getting-the-parameters-and-their-names-of-scvi/815/2 "2022-12-10T03:06:18Z")

</div>

You want to do something like

```python
model = scvi.model.SCVI(adata)
model.module # this is a pytorch module
model.module.named_parameters()

```

---

<div class="post-metadata">

**Author:** ![nh-codem](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/nh-codem/32/1234_2.png) [@nh-codem](https://discourse.scverse.org/u/nh-codem)\
**Post date:** [November 27, 2024, 2:40am UTC](https://discourse.scverse.org/t/getting-the-parameters-and-their-names-of-scvi/815/3 "2024-11-27T02:40:26Z")

</div>

Hi, I am trying to trace back the parameters set during `scvi_model.train()`. Is there a way to retrieve this information from the trained model? Specifically, I want to confirm whether I had set parameters like `batch_size`, `max_epochs`, and `early_stopping` during training. Because, I suspect I may have modified some code in the notebook.

---

<div class="post-metadata">

**Author:** ![cane11](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/cane11/32/241_2.png) [@cane11](https://discourse.scverse.org/u/cane11)\
**Post date:** [November 27, 2024, 3:04am UTC](https://discourse.scverse.org/t/getting-the-parameters-and-their-names-of-scvi/815/4 "2024-11-27T03:04:15Z")

</div>

No these are not stored and once trained you can’t look them up. You can call train on an existing model several times. This would lead to inconsistencies. We store however the indices of train and validation cells (in adata.obs) as well as the learning rate and kl\_weight if these are adjusted during model training (adoptive lr or kl warmup).
