Skip to content

Commit

Permalink
fix: initialize HYPER_PARAMETERS in VI subclasses.
Browse files Browse the repository at this point in the history
  • Loading branch information
janfb committed Feb 17, 2025
1 parent 18f92b1 commit 436542d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sbi/samplers/vi/vi_divergence_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ def __init__(self, *args, K: int = 8, dreg: bool = False, **kwargs):
self.loss_name = "iwelbo"
self.eps = 1e-7
self.dreg = dreg
if not hasattr(self, 'HYPER_PARAMETERS'):
self.HYPER_PARAMETERS = []

Check warning on line 517 in sbi/samplers/vi/vi_divergence_optimizers.py

View check run for this annotation

Codecov / codecov/patch

sbi/samplers/vi/vi_divergence_optimizers.py#L517

Added line #L517 was not covered by tests
self.HYPER_PARAMETERS += ["K", "dreg"]
if dreg:
self.stick_the_landing = True
Expand Down Expand Up @@ -675,6 +677,8 @@ def __init__(
self.alpha = alpha
self.unbiased = unbiased
super().__init__(*args, **kwargs)
if not hasattr(self, 'HYPER_PARAMETERS'):
self.HYPER_PARAMETERS = []

Check warning on line 681 in sbi/samplers/vi/vi_divergence_optimizers.py

View check run for this annotation

Codecov / codecov/patch

sbi/samplers/vi/vi_divergence_optimizers.py#L681

Added line #L681 was not covered by tests
self.HYPER_PARAMETERS += ["alpha", "unbiased", "dreg"]
self.eps = 1e-5
self.dreg = dreg
Expand Down

0 comments on commit 436542d

Please sign in to comment.