Skip to content

Commit

Permalink
improve entities indexing ith GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Feb 6, 2025
1 parent 9e2ee4a commit 3606a84
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ Requirements: Docker, nodejs (to build the frontend), and optionally [`uv`](http
> **Experimental entities indexing**: it can take a lot of time to generate embeddings for entities. So we recommend to run the script to generate embeddings on a machine with GPU (does not need to be a powerful one, but at least with a GPU, checkout [fastembed GPU docs](https://qdrant.github.io/fastembed/examples/FastEmbed_GPU/) to install the GPU drivers and dependencies)
>
> ```sh
> docker compose -f compose.dev.yml up vectordb
> docker compose -f compose.dev.yml up vectordb -d
> cd packages/expasy-agent
> nohup VECTORDB_URL=http://localhost:6334 uv run --extra gpu src/expasy_agent/indexing/index_entities.py --gpu &
> VECTORDB_URL=http://localhost:6334 nohup uv run --extra gpu src/expasy_agent/indexing/index_entities.py --gpu &
> ```
>
> Then move the entities collection containing the embeddings in `data/qdrant/collections/entities` before starting the stack
Expand Down
2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:

vectordb:
# https://hub.docker.com/r/qdrant/qdrant/tags
image: docker.io/qdrant/qdrant:v1.11.3
image: docker.io/qdrant/qdrant:v1.13.2
# image: qdrant/qdrant:v1.9.2-unprivileged # Unprivileged don't work when mounting a volume
container_name: vectordb
restart: unless-stopped
Expand Down
3 changes: 2 additions & 1 deletion packages/expasy-agent/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ dependencies = [
"langgraph >=0.2.61",
"langchain >=0.2.14",
# "langchain-community >=0.3.17",
"langchain-community @ git+https://github.com/langchain-ai/langchain.git#subdirectory=libs/community",
# "langchain-community @ git+https://github.com/langchain-ai/langchain.git#subdirectory=libs/community",
"langchain-community @ git+https://github.com/vemonet/langchain.git@fix-fastembed-gpu#subdirectory=libs/community",
"langchain-openai >=0.1.22",
"langchain-azure-ai >=0.1.0",
"langchain-groq >=0.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def generate_embeddings_for_entities(gpu: bool = False) -> None:
retrieve_index_data(entity, docs)

# Uncomment the next line to test with a smaller number of entities
docs = docs[:100]
# docs = docs[:100]

print(f"Done querying SPARQL endpoints in {(time.time() - start_time) / 60:.2f} minutes, generating embeddings for {len(docs)} entities...")

Expand Down

0 comments on commit 3606a84

Please sign in to comment.