-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from michaelfeil/1-docs-json-validation
Dramatic speedup: pytorch, JSON encoding, uvicorn
- Loading branch information
Showing
12 changed files
with
427 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,19 @@ | ||
from ..inference.primitives import NpEmbeddingType | ||
from .pymodels import OpenAIEmbeddingResult, _EmbeddingObject, _Usage | ||
from .pymodels import OpenAIEmbeddingResult | ||
|
||
|
||
def list_embeddings_to_response( | ||
embeddings: NpEmbeddingType, model: str, usage: int | ||
) -> OpenAIEmbeddingResult: | ||
return OpenAIEmbeddingResult( | ||
return dict( | ||
model=model, | ||
data=[ | ||
_EmbeddingObject( | ||
dict( | ||
object="embedding", | ||
embedding=emb, | ||
index=count, | ||
) | ||
for count, emb in enumerate(embeddings) | ||
], | ||
usage=_Usage(prompt_tokens=usage, total_tokens=usage), | ||
usage=dict(prompt_tokens=usage, total_tokens=usage), | ||
) | ||
|
||
# return { | ||
# "model": model, | ||
# "data": [ | ||
# dict( | ||
# object="embedding", | ||
# embedding=emb, | ||
# index=count, | ||
# ) | ||
# for count, emb in enumerate(embeddings) | ||
# ], | ||
# "usage": {"prompt_tokens": usage, "total_tokens": usage}, | ||
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FASTAPI_TITLE = "♾️ Infinity - Embedding Inference Server" | ||
FASTAPI_SUMMARY = "Embedding Inference Server - finding TGI for embeddings" | ||
|
||
|
||
def startup_message(host: str, port: str, prefix: str) -> str: | ||
return f""" | ||
♾️ Infinity - Embedding Inference Server | ||
MIT License; Copyright (c) 2023 Michael Feil | ||
Open the Docs via Swagger UI: | ||
http://{host}:{port}/docs | ||
Access model via 'GET': | ||
curl http://{host}:{port}{prefix}/models | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.