def upgrade_state_dict_named(self, state_dict, name):
    '\n        Rename layer norm states from `...layer_norms.0.weight` to\n        `...self_attn_layer_norm.weight` and `...layer_norms.1.weight` to\n        `...final_layer_norm.weight`\n        '
    layer_norm_map = {'0': 'self_attn_layer_norm', '1': 'final_layer_norm'}
    for (old, new) in layer_norm_map.items():
        for m in ('weight', 'bias'):
            k = '{}.layer_norms.{}.{}'.format(name, old, m)
            if (k in state_dict):
                state_dict['{}.{}.{}'.format(name, new, m)] = state_dict[k]
                del state_dict[k]
Rename layer norm states from `...layer_norms.0.weight` to
`...self_attn_layer_norm.weight` and `...layer_norms.1.weight` to
`...final_layer_norm.weight`
def upgrade_state_dict_named(self, state_dict, name):
    '\n        Rename layer norm states from `...layer_norms.0.weight` to\n        `...self_attn_layer_norm.weight` and `...layer_norms.1.weight` to\n        `...final_layer_norm.weight`\n        '
    layer_norm_map = {'0': 'self_attn_layer_norm', '1': 'final_layer_norm'}
    for (old, new) in layer_norm_map.items():
        for m in ('weight', 'bias'):
            k = '{}.layer_norms.{}.{}'.format(name, old, m)
            if (k in state_dict):
                state_dict['{}.{}.{}'.format(name, new, m)] = state_dict[k]
                del state_dict[k]