Skip to content

KeyError: 'hparams' when running tester #11

@rudolfwilliam

Description

@rudolfwilliam

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions