Using a different model instead of "gte-small" - Self Hosted #23632
kallebysantos
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Nice that drop-in model worked. Let me look into easier ways to support custom embedding models. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
Since Supabase releases the 'AI inference in supabase edge functions' the inference of embedding became more simpler.
But for some use cases the default embed model
gte-small
is not so usefull.For example if you are using a non-english language it can result wrong semantic search or bad score results.
Since that I'd investigate the source code of the
edge-functions
image and realize that Supabase team has hard coded thegte-small
. So if you want to change it to a custom model is there some modifications to do.The simpler way is by overwriting the default model inside de docker image. Since de api lib just look for a folder called
gte-small
we can change themodel.onnx
for whatever we want. In my specific case I choose theparaphrase-multilingual-MiniLM-L12-v2
because this model works very well withPortuguese
.But for it work, we need to get an
ONNX runtime
converted model, so I we use theXenova
version of it.So lets get it work!
First of all create a custom Dockerfile
Then modify your compose to build and use our custom image
Finally we can call our custom model
Here you need to keep the
gte-small
reference for api compatibility, because it was hard codedI now that is a little tricky but should work until Supabase release a built-in support for custom models, as well some GPU support should be nice too
Beta Was this translation helpful? Give feedback.
All reactions