Could you add a code snippet which would create the state_dict in the desired format, so that I could use your current code to load and debug it, please? I cannot see any obvious issues and would need to dig a bit into the code.