Fail to convert the Funnel Transformer tensorflow version to transformer one when use the official script
Author: RyanHuangNLP
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version:3.5.1
- Platform:Centos
- Python version:3.7
- PyTorch version (GPU?):1.6.0
- Tensorflow version (GPU?):2.3.2
- Using GPU in script?:yes
- Using distributed or parallel set-up in script?:yes


## Information

Model I am using (Bert, XLNet ...):Funnel Transformer


## To reproduce

Steps to reproduce the behavior:

1.use the script `convert_funnel_original_tf_checkpoint_to_pytorch.py`@sgugger @LysandreJik
raise error
```
Traceback (most recent call last):
  File "run_pretraining.py", line 158, in <module>
    convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path)
  File "run_pretraining.py", line 40, in convert_tf_checkpoint_to_pytorch
    load_tf_weights_in_funnel(model, config, tf_checkpoint_path)
  File "run_pretraining.py", line 122, in load_tf_weights_in_funnel
    pointer = getattr(pointer, _layer_map[m_name])
  File "/root/miniconda3/envs/transformers/lib/python3.7/site-packages/torch/nn/modules/module.py", line 772, in __getattr__
    type(self).__name__, name))
torch.nn.modules.module.ModuleAttributeError: 'FunnelForPreTraining' object has no attribute 'embeddings'
```
2.
3.

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->


Comments:
Hi! Could you explain the full procedure? Where did you obtain the Funnel transformer TensorFlow version? Is it a model you trained yourself using another framework? (like this one: https://github.com/laiguokun/Funnel-Transformer)

just use the official ones(like this one: https://github.com/laiguokun/Funnel-Transformer) @LysandreJik 
the layer map "input" -> "embedding", raise error

Could you provide the configuration you used, as well as which Funnel Transformer (which identifier? Is it the TensorFlow or the TensorFlow-Full) you tried to convert? Thank you

@LysandreJik I was train my funnel with the official code, I think my pretrain tensorflow is Tensorflow-Full with the adam weight. May be I need to transform my pretrain model to the TensorFlow or the TensorFlow-Full one first, then use the convert script to change to the transformer one?

I see! Can you try the fix proposed in #9683 and let me know if it fixes your issue?
You can install it in your environment with:
```
pip install git+https://github.com/huggingface/transformers.git@convert_funnel
```

or if you have a clone of the repository, you can pull it and checkout the `convert_funnel` branch.

@LysandreJik Thanks for quickly reply. I will take a try.

@LysandreJik It has raise a new error, I cannot `convert_funnel ` branch, I found that it has merge to `master` branch, so I use the `master` branch

when set `base_model=False`

```
from transformers.models.funnel.convert_funnel_original_tf_checkpoint_to_pytorch import convert_tf_checkpoint_to_pytorch

tf_checkpoint_path = "xxxx/B6-6-6H768-ELEC-TF_model.ckpt"

config_file = "xxxxxx"

pytorch_dump_path = "xxxxxx/funnel-base"

convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, pytorch_dump_path, False)
```

```
  File "test.py", line 9, in <module>
    convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, pytorch_dump_path, False)
  File "/root/miniconda3/envs/transformers/lib/python3.7/site-packages/transformers-4.3.0.dev0-py3.7.egg/transformers/models/funnel/convert_funnel_original_tf_checkpoint_to_pytorch.py", line 36, in convert_tf_checkpoint_to_pytorch
    load_tf_weights_in_funnel(model, config, tf_checkpoint_path)
  File "/root/miniconda3/envs/transformers/lib/python3.7/site-packages/transformers-4.3.0.dev0-py3.7.egg/transformers/models/funnel/modeling_funnel.py", line 136, in load_tf_weights_in_funnel
    pointer = pointer.layers[layer_index]
  File "/root/miniconda3/envs/transformers/lib/python3.7/site-packages/torch/nn/modules/container.py", line 164, in __getitem__
    return self._modules[self._get_abs_string_index(idx)]
  File "/root/miniconda3/envs/transformers/lib/python3.7/site-packages/torch/nn/modules/container.py", line 154, in _get_abs_string_index
    raise IndexError('index {} is out of range'.format(idx))
IndexError: index 6 is out of range
```

when set `base_model=True`

```
from transformers.models.funnel.convert_funnel_original_tf_checkpoint_to_pytorch import convert_tf_checkpoint_to_pytorch

tf_checkpoint_path = "xxxx/B6-6-6H768-ELEC-TF_model.ckpt"

config_file = "xxxxxx"

pytorch_dump_path = "xxxxxx/funnel-base"

convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, pytorch_dump_path, True)
```

```
Traceback (most recent call last):
  File "test.py", line 9, in <module>
    convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, config_file, pytorch_dump_path, True)
  File "/root/miniconda3/envs/transformers/lib/python3.7/site-packages/transformers-4.3.0.dev0-py3.7.egg/transformers/models/funnel/convert_funnel_original_tf_checkpoint_to_pytorch.py", line 36, in convert_tf_checkpoint_to_pytorch
    load_tf_weights_in_funnel(model, config, tf_checkpoint_path)
  File "/root/miniconda3/envs/transformers/lib/python3.7/site-packages/transformers-4.3.0.dev0-py3.7.egg/transformers/models/funnel/modeling_funnel.py", line 136, in load_tf_weights_in_funnel
    pointer = pointer.layers[layer_index]
  File "/root/miniconda3/envs/transformers/lib/python3.7/site-packages/torch/nn/modules/module.py", line 772, in __getattr__
    type(self).__name__, name))
torch.nn.modules.module.ModuleAttributeError: 'FunnelEncoder' object has no attribute 'layers'
```

@sgugger do you have an idea of what might be going wrong?

@LysandreJik Which config file is using, I use the original full version tensorflow one `net_config.json`

```
{
    "block_size": "6_6_6",
    "d_embed": 768,
    "d_head": 64,
    "d_inner": 3072,
    "d_model": 768,
    "decoder_size": "2",
    "dropact": 0.0,
    "dropatt": 0.1,
    "dropout": 0.1,
    "ff_activation": "gelu",
    "init": "truncated_normal",
    "init_range": 0.1,
    "init_std": 0.02,
    "n_head": 12,
    "pool_q_only": true,
    "pooling_size": 2,
    "pooling_type": "mean",
    "rel_attn_type": "factorized",
    "separate_cls": true,
    "vocab_size": 21128
}
```

No you need to convert your configuration first to a proper `FunnelConfig`, that is what the conversion script is expecting.

@LysandreJik @sgugger Now the setting is the same, but still raise error, cannot convert the full tensorflow version to transformers ones

Like I said before, it works for me. So without more information about the environment, the command you launch and the stack trace, there is really nothing we can do to help.

> @LysandreJik Which config file is using, I use the original full version tensorflow one `net_config.json`
> 
> ```
> {
>     "block_size": "6_6_6",
>     "d_embed": 768,
>     "d_head": 64,
>     "d_inner": 3072,
>     "d_model": 768,
>     "decoder_size": "2",
>     "dropact": 0.0,
>     "dropatt": 0.1,
>     "dropout": 0.1,
>     "ff_activation": "gelu",
>     "init": "truncated_normal",
>     "init_range": 0.1,
>     "init_std": 0.02,
>     "n_head": 12,
>     "pool_q_only": true,
>     "pooling_size": 2,
>     "pooling_type": "mean",
>     "rel_attn_type": "factorized",
>     "separate_cls": true,
>     "vocab_size": 21128
> }
> ```

I got the same problem as you and I manage to convert the checkpoint by using the config file at the hugging face model hub. If  you use 6-6-6 block use this one https://huggingface.co/funnel-transformer/intermediate/raw/main/config.json and change vocab size.

@sgugger @LysandreJik I think is the config file problem, I try @NLP33 advise fix the problem

@RyanHuangNLP I have asked you before to give us the command your launch, the environment you use and a the content of the config file you are using. There is no point tagging me further on this issue with a vague message if you are not willing to share for those information as I cannot investigate a bug I cannot reproduce.
As I also said before and @NLP33 indicated, the script only supports config files corresponding to a config created by using `FunnelConfig` from transformers. It does not support the original config files from the original repo.