Add depth estimation pipeline
# 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.
* I tried debugging
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 #18446 


## Before submitting
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [x] 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.
- [x] 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).
- [ ] Did you write any new necessary tests?


## Who can review?
@NielsRogge @Narsil 
<!-- 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

 -->

## Error While using the pipeline
```
pipe = pipeline("depth-estimation")
No model was supplied, defaulted to Intel/dpt-large and revision e93beec (https://huggingface.co/Intel/dpt-large).
Using a pipeline without specifying a model name and revision in production is not recommended.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nandwalritik/nandwalritik/transformers/src/transformers/pipelines/__init__.py", line 670, in pipeline
    framework, model = infer_framework_load_model(
  File "/home/nandwalritik/nandwalritik/transformers/src/transformers/pipelines/base.py", line 257, in infer_framework_load_model
    model = model_class.from_pretrained(model, **kwargs)
  File "/home/nandwalritik/nandwalritik/transformers/src/transformers/models/auto/auto_factory.py", line 445, in from_pretrained
    model_class = _get_model_class(config, cls._model_mapping)
  File "/home/nandwalritik/nandwalritik/transformers/src/transformers/models/auto/auto_factory.py", line 359, in _get_model_class
    supported_models = model_mapping[type(config)]
  File "/home/nandwalritik/nandwalritik/transformers/src/transformers/models/auto/auto_factory.py", line 565, in __getitem__
    return self._load_attr_from_module(model_type, model_name)
  File "/home/nandwalritik/nandwalritik/transformers/src/transformers/models/auto/auto_factory.py", line 579, in _load_attr_from_module
    return getattribute_from_module(self._modules[module_name], attr)
  File "/home/nandwalritik/nandwalritik/transformers/src/transformers/models/auto/auto_factory.py", line 539, in getattribute_from_module
    return getattribute_from_module(transformers_module, attr)
  File "/home/nandwalritik/nandwalritik/transformers/src/transformers/models/auto/auto_factory.py", line 539, in getattribute_from_module
    return getattribute_from_module(transformers_module, attr)
  File "/home/nandwalritik/nandwalritik/transformers/src/transformers/models/auto/auto_factory.py", line 539, in getattribute_from_module
    return getattribute_from_module(transformers_module, attr)
  [Previous line repeated 982 more times]
  File "/home/nandwalritik/nandwalritik/transformers/src/transformers/models/auto/auto_factory.py", line 538, in getattribute_from_module
    transformers_module = importlib.import_module("transformers")
  File "/home/nandwalritik/anaconda3/envs/hftfSwinDev/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load
  File "<frozen importlib._bootstrap>", line 157, in __enter__
  File "<frozen importlib._bootstrap>", line 183, in _get_module_lock
  File "<frozen importlib._bootstrap>", line 59, in __init__
RecursionError: maximum recursion depth exceeded while calling a Python object
```

_The documentation is not available anymore as the PR was closed or merged._<|||||>Hi @NielsRogge @Narsil  I tried debugging to resolve above issue, I found that in `src/transformers/models/auto/auto_factory.py` in line 462  `model_class = _get_model_class(config, cls._model_mapping)` when I logged `cls._model_mapping` I recieved
```
OrderedDict([(<class 'transformers...PTConfig'>, <?>), (<class 'transformers...PNConfig'>, <?>)])
<error>:
Traceback (most recent call last):
```
Can you guide me to resolve this error.<|||||>> Great PR, you also need to add
> 
> ```python
> +    def _sanitize_parameters(self, **kwargs):
> +        return {}, {}, {}
> +
> ```
> 
> To the pipeline, it's not used but the base class expects this method to exist. (Here there's not parameters declared so it's quite easy.
> 
> This weird method exist to allow parameters to be defined both at definition time or call tiime
> 
> ```
> pipe = pipeline(model=model, myargs=1)
> data = pipe(image)
> # or
> pipe = pipeline(model=model)
> data = pipe(image, myargs=1)
> ```
> 
> Cheers ! Otherwise LGTM.
> 
> Why do you output 3 different images ? That sounds like a lot.
> 
> The image I can understand, the predicted depth is defined in what unit ? Is it noisy hence the interpolation ? IMO that seems like something to be left to the user to decide what to do.
> 
> In general I think a pure image would be nice (to be a bit more general) but I can understand that the loss of precision might be harmful, do you mind sharing how you use those numbers ? Maybe we could output an other time of image that doesn't loose information (keeping f32 pixel)
> 
> Wdyt ?

I just saw `DPT`'s depth estimation example and added these three outputs. I have removed the interpolation one and In the output I have kept only the `predicted_depth` (which is a `tensor`) and `depth` (which is the PIL `Image` object).
Let me know if I should remove the `predicted_depth` also.
<|||||>> ### Review required
> At least 1 approving review is required by reviewers with write access. [Learn more.](https://docs.github.com/articles/about-pull-request-reviews/)
> ** 1 pending reviewer **

By generic test did you mean `run_pipeline_test` ? Let me know if it's other than this, I have added `run_pipeline_test` for now.
Also In CI `test_pipelines_depth_estimation` is failing can you help me with that ? <|||||>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.<|||||>Hi @nandwalritik, could you revive this PR by rebasing with the main branch? <|||||>> Hi @nandwalritik, could you revive this PR by rebasing with the main branch?

Done.<|||||>@nandwalritik Do you want to help to get the PR green ?<|||||>> @nandwalritik Do you want to help to get the PR green ?

@Narsil Yeah please , I tried but I was not able to make the test cases pass.<|||||>> Added some comments on how I fixed the CI for you.

Thanks I will look at them.<|||||>@sgugger for final review.<|||||>@sgugger the test failure seem unrelated to the PR, should we go ahead and  merge ?<|||||>Yes, those are flaky tests.