-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
move cli to extra file, macOS tests add documentation #501
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
36c7a4c
add documentation
michaelfeil e336f8f
Merge branch 'main' into add-documentation
michaelfeil 013dad9
update files: for cli
michaelfeil f5d2d6f
update cli definition
michaelfeil 46dc3d7
update: openapi
michaelfeil 093b78a
undo: infer changes
michaelfeil 6ddbeef
loosen: openai-restrictions
michaelfeil f995cfa
update docs, update mac unit tests
michaelfeil 990f4d0
update: cli / docs
michaelfeil 286de3e
add cli / test
michaelfeil 0e06121
refactor cli . inf server tests
michaelfeil bfff7d6
cli: remove defered typing
michaelfeil 350f9d8
improve tolerance of embedding compat
michaelfeil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,108 +0,0 @@ | ||
# [Infinity](https://github.com/michaelfeil/infinity) | ||
|
||
Infinity is a high-throughput, low-latency REST API for serving vector embeddings, supporting all sentence-transformer models and frameworks. Infinity is developed under [MIT License](https://github.com/michaelfeil/infinity/blob/main/LICENSE). Infinity powers inference behind [Gradient.ai](https://gradient.ai) and other Embedding API providers. | ||
|
||
## Why Infinity | ||
|
||
Infinity provides the following features: | ||
|
||
* **Deploy any model from MTEB**: deploy the model you know from [SentenceTransformers](https://github.com/UKPLab/sentence-transformers/) | ||
* **Fast inference backends**: The inference server is built on top of [torch](https://github.com/pytorch/pytorch), [optimum(onnx/tensorrt)](https://huggingface.co/docs/optimum/index) and [CTranslate2](https://github.com/OpenNMT/CTranslate2), using FlashAttention to get the most out of **CUDA**, **ROCM**, **CPU** or **MPS** device. | ||
* **Dynamic batching**: New embedding requests are queued while GPU is busy with the previous ones. New requests are squeezed intro your device as soon as ready. Similar max throughput on GPU as text-embeddings-inference. | ||
* **Correct and tested implementation**: Unit and end-to-end tested. Embeddings via infinity are identical to [SentenceTransformers](https://github.com/UKPLab/sentence-transformers/) (up to numerical precision). Lets API users create embeddings till infinity and beyond. | ||
* **Easy to use**: The API is built on top of [FastAPI](https://fastapi.tiangolo.com/), [Swagger](https://swagger.io/) makes it fully documented. API are aligned to [OpenAI's Embedding specs](https://platform.openai.com/docs/guides/embeddings/what-are-embeddings). See below on how to get started. | ||
|
||
## Getting started | ||
|
||
Install `infinity_emb` via pip | ||
```bash | ||
pip install infinity-emb[all] | ||
``` | ||
|
||
<details> | ||
<summary>Install from source with Poetry</summary> | ||
|
||
Advanced: | ||
To install via Poetry use Poetry 1.8.4, Python 3.11 on Ubuntu 22.04 | ||
```bash | ||
git clone https://github.com/michaelfeil/infinity | ||
cd infinity | ||
cd libs/infinity_emb | ||
poetry install --extras all | ||
``` | ||
</details> | ||
|
||
### Launch the CLI using a pre-built docker container (recommended) | ||
|
||
```bash | ||
port=7997 | ||
model1=michaelfeil/bge-small-en-v1.5 | ||
model2=mixedbread-ai/mxbai-rerank-xsmall-v1 | ||
volume=$PWD/data | ||
|
||
docker run -it --gpus all \ | ||
-v $volume:/app/.cache \ | ||
-p $port:$port \ | ||
michaelf34/infinity:latest \ | ||
v2 \ | ||
--model-id $model1 \ | ||
--model-id $model2 \ | ||
--port $port | ||
``` | ||
The cache path inside the docker container is set by the environment variable `HF_HOME`. | ||
|
||
### or launch the cli after the pip install | ||
After your pip install, with your venv activate, you can run the CLI directly. | ||
Check the `--help` command to get a description for all parameters. | ||
|
||
```bash | ||
infinity_emb --help | ||
``` | ||
|
||
## Launch FAQ | ||
<details> | ||
<summary>What are embedding models?</summary> | ||
Embedding models can map any text to a low-dimensional dense vector which can be used for tasks like retrieval, classification, clustering, or semantic search. | ||
And it also can be used in vector databases for LLMs. | ||
|
||
|
||
The most know architecture are encoder-only transformers such as BERT, and most popular implementation include [SentenceTransformers](https://github.com/UKPLab/sentence-transformers/). | ||
</details> | ||
|
||
<details> | ||
<summary>What models are supported?</summary> | ||
|
||
All models of the sentence transformers org are supported https://huggingface.co/sentence-transformers / sbert.net. | ||
LLM's like LLAMA2-7B are not intended for deployment. | ||
|
||
|
||
With the command `--engine torch` the model must be compatible with https://github.com/UKPLab/sentence-transformers/. | ||
- only models from Huggingface are supported. | ||
|
||
|
||
With the command `--engine ctranslate2` | ||
- only `BERT` models are supported. | ||
- only models from Huggingface are supported. | ||
|
||
|
||
For the latest trends, you might want to check out one of the following models. | ||
https://huggingface.co/spaces/mteb/leaderboard | ||
|
||
</details> | ||
|
||
|
||
<details> | ||
<summary>Using Langchain with Infinity</summary> | ||
Now available under # Python Integrations in the side panel. | ||
``` | ||
</details> | ||
|
||
|
||
<details> | ||
<summary>Question not answered here?</summary> | ||
|
||
There is a Discussion section on the Github of Infinity: | ||
https://github.com/michaelfeil/infinity/discussions | ||
|
||
</details> | ||
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: consider rephrasing to 'Infinity is an open source project' for better clarity