Using FNet model in Encoder Decoder Models
Hello every one


I want to train a model with an encoder with FNet model and decoder with another transformer model like gpt. I searched and found EncoderDecoderModel in hugging face library which makes such changes easier. I put the link below:

[(https://huggingface.co/transformers/v3.5.1/model_doc/encoderdecoder.html#transformers.EncoderDecoderModel](url)
. I want to use the FNet model in Encoder Decoder Models but cannot. because I face this error: 

> TypeError: forward() got an unexpected keyword argument 'attention_mask'

I understand that this is because FNet does not have attention, but I do not know how to resolve it.

I searched the internet and found out that EncoderDecoderModel does not work for all transformer models and I wanted to know why and wanted to suggest adding FNet.
Hi @Parmida-Granfar 

I would suggest to make the necessary changes to the `EncoderDecoderModel` and/or `FNetModel` code according your own need.
As you have already observed `FNet does not have attention` (very nice finding 💯 ), you can remove the following line

https://github.com/huggingface/transformers/blob/5fd4e3c87c685fba2dd9615be62131748a8b5ee3/src/transformers/models/encoder_decoder/modeling_encoder_decoder.py#L592

and see if everything works then. If you still need any further help, I am more than happy to answer (but in a thread on [Hugging Face Forums](https://discuss.huggingface.co/) instead)

With all the modeling architectures coming out at a fast pace nowadays, it's not practical and realistic to make composite modeling like `EncoderDecoder` to handle all pairs of encoder and decoder models. But the good thing is the code is open source, and everyone can make changes to it :-). 
<|||||>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.