Skip to content

proitservices/elmo_embedding_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

╭━━━┳╮╱╱╱╱╱╱╱╱╱╭━━━╮╱╱╭╮╱╱╱╱╱╱╭╮╱╭╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭╮
┃╭━━┫┃╱╱╱╱╱╱╱╱╱┃╭━━╯╱╱┃┃╱╱╱╱╱╱┃┃╱┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭╯┃
┃╰━━┫┃╭╮╭┳━━╮╱╱┃╰━━┳╮╭┫╰━┳━━┳━╯┣━╯┣┳━╮╭━━┳━━╮╱╱╱╱╭╮┣╮┃
┃╭━━┫┃┃╰╯┃╭╮┣━━┫╭━━┫╰╯┃╭╮┃┃━┫╭╮┃╭╮┣┫╭╮┫╭╮┃━━┫╭━━╮┃╰╯┃┃
┃╰━━┫╰┫┃┃┃╰╯┣━━┫╰━━┫┃┃┃╰╯┃┃━┫╰╯┃╰╯┃┃┃┃┃╰╯┣━━┃╰━━╯╰╮╭╯╰╮
╰━━━┻━┻┻┻┻━━╯╱╱╰━━━┻┻┻┻━━┻━━┻━━┻━━┻┻╯╰┻━╮┣━━╯╱╱╱╱╱╰┻━━╯
╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╯┃
╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰━━╯

      "author":"Piotr Romanowski"
      "version": "1.4"
      "release": "13/05/2023 01:22"

elmo_embedding_api

Drop in replacement for openai ada

Reason - local is good limits - you can create a 1024 dimensional embeddings for your application and only your box is the limit tested - 9383 tokens in 2min 33 sec on 8 core i7 machine

how to start it up

building the docker image: clone this repository and at the top level run sudo docker build -t elmo-embedding-api .

placing the model: Download the desired model to the ./model/directory and unzip it.

start the container (initial start and call will take few extra seconds): sudo docker run -p 5001:5001 -v ./model:/app/model -v ./logs:/app/logs --name elmo-embedding-api peterromanowski/elmo-embedding-api:0.1.4

pulling from docker.hub:

docker pull peterromanowski/elmo-embedding-api:0.1.4 [nearly ~4GB] (use sudo if you get perm issues)

example: #curl -X POST http://localhost:5001/v1/embeddings -H 'Content-Type: application/json' -d "{\"input\": [\"some text\",\"some more interesting text\",\"additional context\"]}"

response schema mimics open ai ada .. with added multi input and multi output as list

{
  "data": [
    {
      "embedding": [
        -0.006929283495992422,
        -0.005336422007530928,
        ...
        -4.547132266452536e-05,
        -0.024047505110502243
      ],
      "index": 0,
      "object": "embedding"
    }
  ],
  "model": "text-embedding-elmo-002",
  "object": "list",
  "usage": {
    "prompt_tokens": 5,
    "total_tokens": 5
  }
}



I hope it will help you in your own project. 
If you do have questions feel free to reach out. 
Enjoy!

About

Local drop-in replacement for openai ada embedding

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published