Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'hparams' when running tester #11

Open
rudolfwilliam opened this issue Jul 5, 2023 · 2 comments
Open

KeyError: 'hparams' when running tester #11

rudolfwilliam opened this issue Jul 5, 2023 · 2 comments

Comments

@rudolfwilliam
Copy link

I trained the full model on Morpho-MNIST using the command

python -m deepscm.experiments.morphomnist.trainer -e SVIExperiment -m ConditionalVISEM --data_dir /path/to/data --default_root_dir /path/to/checkpoints --decoder_type fixed_var.

This worked without issues. However, for running python -m deepscm.experiments.morphomnist.tester -c /path/to/checkpoint/version_0, I get KeyError: 'hparams' in torch.load(checkpoint_path, map_location=torch.device('cpu'))['hparams'].

Indeed, I saw in the debugger that 'hparams' does not exist as dictionary key. However, there exists a key called 'hyper_parameters'. Upon changing that (which already seems wrong), I get an error further down in the line exp_class.load_from_checkpoint(checkpoint_path, pyro_model=model), saying TypeError: __init__() missing 1 required positional argument: 'hparams'.

I checked the code and to me the errors do seem plausible. I would be more surprised if this code would work for anyone. I did use the correct python & package versions.

@ktncktnc
Copy link

ktncktnc commented Feb 5, 2024

Do you still want to fix it, I can help.

@rudolfwilliam
Copy link
Author

I fixed it myself in the meantime by rewriting the code. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants