maho3 / ltu-ili

Robust ML in Astro
https://ltu-ili.readthedocs.io/en/latest/
43 stars 8 forks source link

`sbi_runner` breaks with new `sbi` package update #165

Open tlmakinen opened 2 weeks ago

tlmakinen commented 2 weeks ago

for example, in calling

posterior_ensemble, summaries = runner(loader=loader)

sbi has evidently changed their naming convention for the outputs... maybe we ought to require sbi==0.22.0 in the install ? (still testing the downgrade)

File [~/venvs/epe/lib64/python3.11/site-packages/ili/inference/runner_sbi.py:245](http://localhost:1999/lab/tree/repositories/epe_hybrid/venvs/epe/lib64/python3.11/site-packages/ili/inference/runner_sbi.py#line=244), in <listcomp>(.0)
    241     summaries.append(model.summary)
    243 # ensemble all trained models, weighted by validation loss
    244 val_logprob = torch.tensor(
--> 245     [float(x["best_validation_log_prob"][-1]) for x in summaries]
    246 ).to(self.device)
    247 # Exponentiate with numerical stability
    248 weights = torch.exp(val_logprob - val_logprob.max())

KeyError: 'best_validation_log_prob'
tlmakinen commented 2 weeks ago

update: downgrading to version 0.22.0 fixed the bug in my usecase