Skip to content

Error(s) in loading state_dict for DataParallel in generating_samples.py #43

@giusepperizzo

Description

@giusepperizzo

After a whole training with

$ python3 sourcecode/train.py --depth=7 --latent_size=256 --images_dir=DATASET --sample_dir=sampledir/exp2 --model_dir=modeldir/exp2

when launching

$ python3 sourcecode/generate_samples.py --generator_file=modeldir/exp2/GAN_GEN_100.pth --depth=7 --out_dir=outputdir

I got:

''
Creating generator object ...
Loading the generator weights from: modeldir/exp2/GAN_GEN_100.pth
Traceback (most recent call last):
File "sourcecode/generate_samples.py", line 134, in
main(parse_arguments())
File "sourcecode/generate_samples.py", line 105, in main
gen.load_state_dict(
File "~/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for DataParallel:
Missing key(s) in state_dict: "module.layers.7.conv_1.weight", "module.layers.7.conv_1.bias", "module.layers.7.conv_2.weight", "module.layers.7.conv_2.bias", "module.layers.8.conv_1.weight", "module.layers.8.conv_1.bias", "module.layers.8.conv_2.weight", "module.layers.8.conv_2.bias", "module.rgb_converters.7.weight", "module.rgb_converters.7.bias", "module.rgb_converters.8.weight", "module.rgb_converters.8.bias".
''

Both training and generation are executed on the same machine with multiple GPUs enabled and ready.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions