Add `push_to_hub( )`  to pipeline 
Author: not-lain
Pull request: yes

# What does this PR do?
this will add a push_to_hub( ) method when working with pipelines. 
this is a fix for #28857 allowing for easier way to push custom pipelines to huggingface

Fixes #28857 

## 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/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.
- [ ] 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?

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.


@Narsil @Rocketknight1 @ArthurZucker  

I have also added a notebook showcasing how to use the new method : https://colab.research.google.com/drive/1yCET-FdkI4kHK1B-VUrrM7sKHMO3LkOg?usp=sharing

all that is missing is to fix the docstring and maybe add more tests to figure out what else that needs to be fixed

Comments:
the docstring will need more cleaning, I'll leave it to another pull request since it does not affect the workflow

![image](https://github.com/huggingface/transformers/assets/70411813/caccfd26-2c53-4d40-baee-d7ccf347ade4)


cc @ArthurZucker can I ask for a review on this one ?

@ArthurZucker what i ment is that i couldn't fix the docstring since we are inhering from PushToHubMixin, there are some ways around this, so i will leave the final decision to you.

as for the pipeline, this pull request will only add a `pipe.push_to_hub( )` method to it, allowing people to push their custom pipeline codes easily to the hub, refer to the colab notebook mentioned above

this pull request does **NOT** add a `pipeline.from_pretrained( )`, but I wanted to highlight what other things that need fixing (the docstring) 

fixed the docstring
![image](https://github.com/huggingface/transformers/assets/70411813/d051f888-ab64-4151-bbe7-05b60b743d6c)

is the main branch broken ? I really am lost, would love to get a feedback on this, sorry for pushing multiple times i really wanted to fix the docstring ,  7543177c9b4fcef4cb87b905815a0b709bb255a1 and ea93bae96c47919f216f0443f3b28e2e78137937 are literally identical. 

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_28870). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@ArthurZucker sorry for always bothering you, I really hope you are having a wonderful day ✨

as far as the [docs](https://moon-ci-docs.huggingface.co/docs/transformers/pr_28870/en/main_classes/pipelines) go everything is pretty much the same as the main branch.
the only change is that we added a `push_to_hub` method.
as far as the method goes, It's pretty much working for now, I already used it multiple times to push my custom pipelines to the hub, check a commit i made using this version [here](https://huggingface.co/not-lain/CustomCodeForRMBG/commit/c40df9ae88862aaf48d61bd3eec8aea3b618def6).

as for the documentation, only and only [this section of the documentation](https://moon-ci-docs.huggingface.co/docs/transformers/pr_28870/en/main_classes/pipelines#transformers.Pipeline.push_to_hub)  is misleading a little bit.

Personally I really think that the dosctring should be fixed in a different pull request, since this feature is really important. 
Do let me know of what you think. 

apologies again for the tag, but I really need a takeout about this pull request since I need to test the stability for this in regards to issue #28907.

@ArthurZucker sure, can you point me at which file should I add the tests ?

hello @ArthurZucker I have come to realise that I cannot add tests for this pull request, the reason behind this is I cannot and I do not intend to expose my token, I do not also know at which repo I should test push to. Due to lack of these information I will not be able to further assist you futher.
If you have any tests, you wish to add please let the team at huggingface handle them.
the only thing I can provide you with is a code example using this pull request 
https://colab.research.google.com/drive/1yCET-FdkI4kHK1B-VUrrM7sKHMO3LkOg?usp=sharing

@ArthurZucker  closing this pull request and opening a cleaner one :
* no this does not push custom pipeline registeries to the hub, it pushes the already registered pipeline dependencies (code/ files containing the architecture) to the hub
* no i cannot add tests since i don't know how you are storing the secrets and at which repo i should test push my pipeline 
* yes this should be maintained (it only pushes the custom pipeline code to the HF repo, it doesn't change the transformers library)

RMBF1.4, moondream1, nomic-embed-text-v1.5, all of the Qwen models ..... the reason why all of these custom AI models do not include a pipeline is because there is no easy way for them to push the code to the hub, which is why i thought about this feature.
it really doesn't make since to only keep adding models and pipelines to the library while not letting people create a repository and push their custom architectures in them. Again i hope you will reconsider this feature.

additional resources : 
* https://huggingface.co/docs/transformers/custom_models (there is a `push_to_hub` method)
* https://huggingface.co/docs/transformers/en/add_new_pipeline (doesn't include a `push_to_hub` method) 

No worries for the test, I'll handle this pard. Sorry I did not have time to take a clear look at all of this. But sounds like a nice feature addition

@ArthurZucker that would be much appreciated, you can check the new pull request at #29172 any help is appreciated