# Class init func with self.hparams = hparams raising an "AttributeError: can't set attribute"

**URL:** <https://discuss.pytorch.org/t/class-init-func-with-self-hparams-hparams-raising-an-attributeerror-cant-set-attribute/121626>\
**Category:** Uncategorized\
**Created:** [May 18, 2021, 11:32am UTC](https://discuss.pytorch.org/t/class-init-func-with-self-hparams-hparams-raising-an-attributeerror-cant-set-attribute/121626 "2021-05-18T11:32:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Binge\_Kenny](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/binge_kenny/32/38458_2.png) [@Binge\_Kenny](https://discuss.pytorch.org/u/Binge_Kenny)\
**Post date:** [May 18, 2021, 11:32am UTC](https://discuss.pytorch.org/t/class-init-func-with-self-hparams-hparams-raising-an-attributeerror-cant-set-attribute/121626/1 "2021-05-18T11:32:11Z")

</div>

In my LightningModule subclass, I used ‘self.hparams = hparams’ which worked fine a week ago but now it unexpectedly returns an Exception saying “AttributeError: can’t set attribute”.

I believe something has been changed recently in the father class **LightningModule** as this issue should be solved by add a “@ATTRI.setter” but here I cannot access the father class.

```auto
class T5FineTuner(pl.LightningModule):
  def __init__ (self, hparams):
    super(T5FineTuner, self). __init__ ()
    self.hparams = hparams

```

Any way to solve this given a recent update on source code, please?

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [May 19, 2021, 5:11am UTC](https://discuss.pytorch.org/t/class-init-func-with-self-hparams-hparams-raising-an-attributeerror-cant-set-attribute/121626/2 "2021-05-19T05:11:10Z")

</div>

Is this issue already solved [here](https://discuss.pytorch.org/t/pytorch-lightning-module-cant-set-attribute-error/121125/5)?

---

<div class="post-metadata">

**Author:** ![Ajinkya\_Ambatwar](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ajinkya_ambatwar/32/11828_2.png) [@Ajinkya\_Ambatwar](https://discuss.pytorch.org/u/Ajinkya_Ambatwar)\
**Post date:** [May 19, 2021, 5:35am UTC](https://discuss.pytorch.org/t/class-init-func-with-self-hparams-hparams-raising-an-attributeerror-cant-set-attribute/121626/3 "2021-05-19T05:35:41Z")

</div>

Yes @ptrblck, it is solved.
