Problems with convert_blenderbot_original_pytorch_checkpoint_to_pytorch.py 
Author: MichalPleban
Pull request: no

I am trying to use `the convert_blenderbot_original_pytorch_checkpoint_to_pytorch.py` script to convert a finetuned ParlAI Blenderbot-1B-distill model. I call it this way:

```python convert.py --src_path model --hf_config_json config.json```

Where the `config.json` file is downloaded from the HuggingFace repository. Unfortunately, I get the following error:

```
raceback (most recent call last):
  File "C:\Users\micha\Documents\Chatbot\AI\persona3\convert.py", line 114, in <module>
    convert_parlai_checkpoint(args.src_path, args.save_dir, args.hf_config_json)
  File "C:\Users\micha\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\micha\Documents\Chatbot\AI\persona3\convert.py", line 99, in convert_parlai_checkpoint
    rename_layernorm_keys(sd)
  File "C:\Users\micha\Documents\Chatbot\AI\persona3\convert.py", line 68, in rename_layernorm_keys
    v = sd.pop(k)
KeyError: 'model.encoder.layernorm_embedding.weight'
```

And after commenting lines 98 and 99 of the script, it gives a further error:

```
raceback (most recent call last):
  File "C:\Users\micha\Documents\Chatbot\AI\persona3\convert.py", line 114, in <module>
    convert_parlai_checkpoint(args.src_path, args.save_dir, args.hf_config_json)
  File "C:\Users\micha\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\micha\Documents\Chatbot\AI\persona3\convert.py", line 100, in convert_parlai_checkpoint
    m.model.load_state_dict(mapping, strict=True)
  File "C:\Users\micha\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for BartModel:
        size mismatch for encoder.embed_positions.weight: copying a param with shape torch.Size([128, 2560]) from checkpoint, the shape in current model is torch.Size([130, 2560]).
        size mismatch for decoder.embed_positions.weight: copying a param with shape torch.Size([128, 2560]) from checkpoint, the shape in current model is torch.Size([130, 2560]).
```

I tried changing `BartConfig` to `BlenderbotConfig` and `BartForConditionalGeneration` to `BlenderbotForConditionalGeneration` but then it gives still another error:

```
Traceback (most recent call last):
  File "C:\Users\micha\Documents\Chatbot\AI\persona3\convert.py", line 114, in <module>
    convert_parlai_checkpoint(args.src_path, args.save_dir, args.hf_config_json)
  File "C:\Users\micha\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\micha\Documents\Chatbot\AI\persona3\convert.py", line 100, in convert_parlai_checkpoint
    m.model.load_state_dict(mapping, strict=True)
  File "C:\Users\micha\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for BlenderbotModel:
        Missing key(s) in state_dict: "encoder.layer_norm.weight", "encoder.layer_norm.bias", "decoder.layer_norm.weight", "decoder.layer_norm.bias".
```

I changed `strict=True` to `strict=False` and commented out lines 98 & 99 and the script was finally executed, but I am not sure if this is the correct way. I would appreciate help in making the script work as intended.


Comments:
Hi @MichalPleban ! The blenderbot conversion script has not been updated in a long time. It should actually blenderbot classes instead of bart. Feel free to open a PR to fix this if you are interested. Happy to help! 

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.