Adding S4 Model
# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Fixes # (issue)


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @LysandreJik

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->
@Rocketknight1 
@kamalkraj This looks great! Please let us know if you're encountering any problems, and of course ping me when it's ready for a final review.<|||||>Hi @kamalkraj ! We noticed there haven't been any commits here for a while - do you want us to find someone to take it over and resolve the issues from here? Either way, we appreciate everything you've done so far, so don't stress about it!<|||||>Hi @Rocketknight1,

Got a little busy with some work. Will work on this week <|||||>Hi @kamalkraj! We've actually just been speaking with the authors, and they said they're planning a refactor of the model that's going to be released soon. We're going to speak with them about adding it to the hub at that point - either way, though, we'll probably use your existing PR as a base and we'll include you as a co-author.<|||||>Sure @Rocketknight1. 
After the refractor also if you need any help from my side please ping here. 

Thanks<|||||>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/master/CONTRIBUTING.md) are likely to be ignored.<|||||>Hi, any news with this implementation? For some time I finished the @kamalkraj implementation, but I did not refactored the code. @Rocketknight1 was mentioning that the authors were planing to release a cleaner implementation. Do you have any update from the authors on it? also I think that it would be veeeeeery valuable if they also release his pre-trained model. Thanks!<|||||>@gaceladri This is something we're keeping an eye on. We were planning to do a port of the newer implementation, but we've seen [this paper ](https://twitter.com/ankgup2/status/1508807766093217804) recently. We believe this indicates that we're liable to see some significant updates to that architecture before the first foundation models arrive, and so we're backing away a little from porting S4 in its current form, at least until a significant foundation model arrives!

That said, we still think the architecture is likely to be very important, and we're seeing what we can do to get it to the point where those models exist. I know that's a little mysterious, but I don't want to over-promise anything just yet!<|||||>@Rocketknight1 Thanks a lot for the answers and for the paper as well. I had not seen it! Thanks!!<|||||>@Rocketknight1 do you think S4D is already mature enough to get into transformers? On https://github.com/HazyResearch/state-spaces/ it is already on version 3 and there is already a module with few dependencies https://github.com/HazyResearch/state-spaces/blob/main/src/models/s4/

I´m getting extraordinary results compared to regular transformers with small datasets
