Skip to content

Commit 4974886

Browse files
committed
doc: updated readme for initial release
1 parent 43b6f13 commit 4974886

File tree

5 files changed

+52
-17
lines changed

5 files changed

+52
-17
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: ncipollo/release-action@v1
16+
with:
17+
artifacts: "release.tar.gz"
18+
bodyFile: "release.md"
19+
draft: true

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://kcd.im/pull-request)

README.md

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Open Source Text Embedding Models with OpenAI API-Compatible Endpoint
22

3+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
4+
35
Many open source projects support the compatibility of the `completions` and the `chat/completions` endpoints of the OpenAI API, but do not support the `embeddings` endpoint.
46

57
The goal of this project is to create an OpenAI API-compatible version of the `embeddings` endpoint, which serves open source sentence-transformers models and other models supported by the LangChain's [HuggingFaceEmbeddings](https://api.python.langchain.com/en/latest/embeddings/langchain.embeddings.huggingface.HuggingFaceEmbeddings.html), HuggingFaceInstructEmbeddings and HuggingFaceBgeEmbeddings class.
@@ -22,25 +24,33 @@ To run the embeddings endpoint locally as a standalone FastAPI server, follow th
2224

2325
1. Install the dependencies by executing the following commands:
2426

25-
```bash
26-
pip install --no-cache-dir -r server-requirements.txt
27-
pip install --no-cache-dir uvicorn
28-
```
27+
```bash
28+
pip install --no-cache-dir -r server-requirements.txt
29+
pip install --no-cache-dir uvicorn
30+
```
2931

3032
2. Run the server with the desired model using the following command which enabled normalize embeddings (Omit the `NORMALIZE_EMBEDDINGS` if the model don't support normalize embeddings):
3133

32-
```bash
33-
MODEL=intfloat/e5-large-v2 NORMALIZE_EMBEDDINGS=1 python -m open.text.embeddings.server
34-
```
34+
```bash
35+
MODEL=intfloat/e5-large-v2 NORMALIZE_EMBEDDINGS=1 python -m open.text.embeddings.server
36+
```
37+
38+
If a GPU is detected in the runtime environment, the server will automatically execute using the `cuba` mode. However, you have the flexibility to specify the `DEVICE` environment variable to choose between `cpu` and `cuba`. Here's an example of how to run the server with your desired configuration:
39+
40+
```bash
41+
MODEL=intfloat/e5-large-v2 NORMALIZE_EMBEDDINGS=1 DEVICE=cpu python -m open.text.embeddings.server
42+
```
43+
44+
This setup allows you to seamlessly switch between CPU and GPU modes, giving you control over the server's performance based on your specific requirements.
3545

3646
3. You will see the following text from your console once the server has started:
3747

38-
```bash
39-
INFO: Started server process [19705]
40-
INFO: Waiting for application startup.
41-
INFO: Application startup complete.
42-
INFO: Uvicorn running on http://localhost:8000 (Press CTRL+C to quit)
43-
```
48+
```bash
49+
INFO: Started server process [19705]
50+
INFO: Waiting for application startup.
51+
INFO: Application startup complete.
52+
INFO: Uvicorn running on http://localhost:8000 (Press CTRL+C to quit)
53+
```
4454

4555
## AWS Lambda Function
4656

@@ -58,8 +68,12 @@ To get started:
5868

5969
1. Install the dependencies by executing the following command:
6070

61-
```bash
62-
pip install --no-cache-dir -r test-requirements.txt
63-
```
71+
```bash
72+
pip install --no-cache-dir -r test-requirements.txt
73+
```
6474

6575
2. Execute the cells in the notebook to test the embeddings endpoint.
76+
77+
## Contributions
78+
79+
@Vokturz contributed #2: support for CPU/GPU choice and initialization before starting the app.

open/text/embeddings/server/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def create_app():
2323
initialize_embeddings()
2424
app = FastAPI(
2525
title="Open Text Embeddings API",
26-
version="0.0.2",
26+
version="1.0.0",
2727
)
2828
app.add_middleware(
2929
CORSMiddleware,

release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@Vokturz contributed #2: support for CPU/GPU choice and initialization before starting the app

0 commit comments

Comments
 (0)