# Creating inference endpoint with custom handler - is this how it should work?

**URL:** <https://discuss.huggingface.co/t/creating-inference-endpoint-with-custom-handler-is-this-how-it-should-work/26434>\
**Category:** Beginners\
**Created:** [November 21, 2022, 9:46am UTC](https://discuss.huggingface.co/t/creating-inference-endpoint-with-custom-handler-is-this-how-it-should-work/26434 "2022-11-21T09:46:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eykarim](https://avatars.discourse-cdn.com/v4/letter/e/cc9497/32.png) [@eykarim](https://discuss.huggingface.co/u/eykarim)\
**Post date:** [November 21, 2022, 9:46am UTC](https://discuss.huggingface.co/t/creating-inference-endpoint-with-custom-handler-is-this-how-it-should-work/26434/1 "2022-11-21T09:46:19Z")

</div>

I don’t seem to quite understand how to deploy a model with a custom handler as an inference endpoint. Specifically, I’m trying to use this model (which alread has a custom handler): [philschmid/stable-diffusion-v1-4-endpoints · Hugging Face](https://huggingface.co/philschmid/stable-diffusion-v1-4-endpoints)

I went through these steps trying to follow the tutorial:

1. Initialize Git LFS: `git lfs install`
2. Clone the desired repo: `git clone https://huggingface.co/philschmid/stable-diffusion-v1-4-endpoints`
3. Install huggingface-hub python package (in a venv): `python -m venv venv` + `source venv/bin/activate` + `pip install huggingface-hub`
4. Login to Huggingface: `huggingface-cli login` → Choose Yes when asked to add token as git credential
5. Run this command (don’t really understand what it does): `git config --global credential.helper store `

As far as I understand, I don’t need to change anything in the code, since it already has a custom handler. I now need to push the whole thing to a repo that I created before. It’s currently empty: shttps://huggingface.co/eykarim/stable-diffusion-v1

1. I move up one folder into `/stable-diffusion-v1-4-endpoints`
2. I delete the existing `.git` so I can push the whole code to my own repo: `sudo rm -r .git`
3. I initialize a new git: `git init` + `git remote add origin master` + `git remote set-url origin https://huggingface.co/eykarim/stable-diffusion-v1`
4. Add all files to commit to my new remote repo: `git add *` + `git commit -m "my first commit"` + `git push origin master`

At this point I’m getting a git error `error failed to push some refs to https://huggingface.co/eykarim/stable-diffusion-v1`

As far as I understand this should be the right way. Once I have code with a handler.py in my repo, I should be able to find it in the inference endpoints search mask, right? (see screenshot)

 ![Bildschirmfoto_2022-11-21_10-42-47](https://us1.discourse-cdn.com/hellohellohello/original/2X/b/b93478217692629e1e6efd33d0a21de09197a807.png)

Is this the right way to do it? And if so: Maybe someone could help me fix the Git error? That would be great!

---

<div class="post-metadata">

**Author:** ![eykarim](https://avatars.discourse-cdn.com/v4/letter/e/cc9497/32.png) [@eykarim](https://discuss.huggingface.co/u/eykarim)\
**Post date:** [November 24, 2022, 7:45am UTC](https://discuss.huggingface.co/t/creating-inference-endpoint-with-custom-handler-is-this-how-it-should-work/26434/2 "2022-11-24T07:45:22Z")

</div>

Anybody? If someone has a link/resource that could help me solve this by myself, I’d be more than happy! 🙂

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](https://discuss.huggingface.co/u/nielsr)\
**Post date:** [November 24, 2022, 9:12am UTC](https://discuss.huggingface.co/t/creating-inference-endpoint-with-custom-handler-is-this-how-it-should-work/26434/3 "2022-11-24T09:12:31Z")

</div>

cc @philschmid

btw, might be better to post this in the “inference endpoints” section, rather than “beginners”

---

<div class="post-metadata">

**Author:** ![philschmid](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/philschmid/32/38022_2.png) [@philschmid](https://discuss.huggingface.co/u/philschmid)\
**Post date:** [November 24, 2022, 12:55pm UTC](https://discuss.huggingface.co/t/creating-inference-endpoint-with-custom-handler-is-this-how-it-should-work/26434/4 "2022-11-24T12:55:53Z")

</div>

Hello @eykarim,

You can check out this tutorial: [Custom Inference with Hugging Face Inference Endpoints](https://www.philschmid.de/custom-inference-handler)  
or the documentation on how to create custom handlers: [Create custom Inference Handler](https://huggingface.co/docs/inference-endpoints/guides/custom_handler)

Those include e2e example with uploading the model.

FYI we also have a dedicated inference endpoints section in the forum.

---

<div class="post-metadata">

**Author:** ![eykarim](https://avatars.discourse-cdn.com/v4/letter/e/cc9497/32.png) [@eykarim](https://discuss.huggingface.co/u/eykarim)\
**Post date:** [November 27, 2022, 7:31am UTC](https://discuss.huggingface.co/t/creating-inference-endpoint-with-custom-handler-is-this-how-it-should-work/26434/5 "2022-11-27T07:31:14Z")

</div>

Hi Phil! Thanks for the tutorial. I worked through it a second time yesterday and now have a model deployed: [eykarim/stable-diffusion-v1 · Hugging Face](https://huggingface.co/eykarim/stable-diffusion-v1)

As I wrote in my original post, I was assuming that once I have a model deployed with a custom handler (marked as “endpoints-template”) I should be able to deploy it with an Inference Endpoint. However, the model does not show up in the search bar, nor do many of the other models. I don’t understand what requirements a model needs to fullfil in order to be deployed as an Inference Endpoint. Why do some models with an endpoint handler show up in the search bar and others don’t?

 ![Bildschirmfoto_2022-11-26_20-17-13](https://us1.discourse-cdn.com/hellohellohello/original/2X/e/e39867d4dd1d1888095ca785de6f1d7f00db2e87.png)

---

<div class="post-metadata">

**Author:** ![philschmid](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/philschmid/32/38022_2.png) [@philschmid](https://discuss.huggingface.co/u/philschmid)\
**Post date:** [November 27, 2022, 9:44am UTC](https://discuss.huggingface.co/t/creating-inference-endpoint-with-custom-handler-is-this-how-it-should-work/26434/6 "2022-11-27T09:44:58Z")

</div>

I responded in your other thread: [Why is my model not showing up in the search bar for Inference Endpoints? - #2 by philschmid](https://discuss.huggingface.co/t/why-is-my-model-not-showing-up-in-the-search-bar-for-inference-endpoints/26771/2)
