Align backbone stage selection with out_indices & out_features
Author: amyeroberts
Pull request: yes

# What does this PR do?

This PR adds a set of input verification for the `out_features` and `out_indices` arguments for backbones, making sure that any accepted values align with the returned model outputs. 

## More details

`out_features` and `out_indices` are used to specify which blocks' attentions are returned by the Backbone classes. 

The following can currently be passed in `out_features`: 
* Out-of-order stages: `["stage5", "stage2", "stage4"]`
* Double stages: `["stage3", "stage3"]`

However, this is will not be reflected in the returned feature maps on a forward pass e.g. [here for ResNet](https://github.com/huggingface/transformers/blob/4151fbb49c42bd22f8bf18b1773e09aa84846bdd/src/transformers/models/resnet/modeling_resnet.py#L499). The feature maps are selected by iterating over the stage_names (ordered list of all stages in the backbone) and returning those that have their name in `out_features` and so are in stage-order and will only be selected once. 

There is also a misalignment between the TimmBackbone and transformers backbones - as timm will automatically take the set of indices (removing duplicates) whereas transformers will keep them in the `out_indices` attribute. 



## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/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/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?


Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_27606). All of your documentation changes will be reflected on that endpoint.

> Hey! Could you elaborate on the motivation behind the out of order or duplicated (seems to be a choice rather than a bug fix for me no?)

@ArthurZucker Sure! It's both - a choice and a current bug. The choice is whether we allow passing in different orders and duplicates and the bug is whether this is reflected. At the moment I can pass in duplicates, out-of-order etc. but it won't be reflected in the returned stages. Another option is for input verification where we raise an error if the user chooses `out_features` or `out_indices` which have these properties. I could implement that instead? It might be a bit more defensive 


@ArthurZucker Sorry to flip-flop. I've thought a bit more and concluded that not allowing repetitions & different orders when setting `out_features` and `out_indices` would be better: 
* It's possible to enable more flexible arguments later in the future but not the other way around - this wouldn't be backward compatible
* Adding checks is backwards compatible: new errors might be raised with existing inputs but these would start flagging unexpected behaviour
* Having multiple or out-of-order arguments is something the user can handle on their side after receiving the outputs

I'm going to update the PR to add these checks + relevant tests instead 

@ArthurZucker There's isn't any proper documentation for the backbones atm - this is being added in #27456. I've added notes about the restrictions in the docstrings