Skip to content
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

fix: unify embedding models #2027

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion fern/docs/pages/installation/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,22 @@ PrivateGPT uses the `AutoTokenizer` library to tokenize input text accurately. I
```
2. **Set Access Token for Gated Models:**
If you are using a gated model, ensure the `access_token` is set as mentioned in the previous section.
This configuration ensures that PrivateGPT can download and use the correct tokenizer for the model you are working with.
This configuration ensures that PrivateGPT can download and use the correct tokenizer for the model you are working with.

# Embedding dimensions mismatch
If you encounter an error message like `Embedding dimensions mismatch`, it is likely due to the embedding model and
current vector dimension mismatch. To resolve this issue, ensure that the model and the input data have the same vector dimensions.

By default, PrivateGPT uses `nomic-embed-text` embeddings, which have a vector dimension of 768.
If you are using a different embedding model, ensure that the vector dimensions match the model's output.

<Callout intent = "warning">
In versions below to 0.6.0, the default embedding model was `BAAI/bge-small-en-v1.5` in `huggingface` setup.
If you plan to reuse the old generated embeddings, you need to update the `settings.yaml` file to use the correct embedding model:
```yaml
huggingface:
embedding_hf_model_name: BAAI/bge-small-en-v1.5
embedding:
embed_dim: 384
```
</Callout>
2 changes: 1 addition & 1 deletion settings-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ llamacpp:
llm_hf_model_file: ${PGPT_HF_MODEL_FILE:mistral-7b-instruct-v0.1.Q4_K_M.gguf}

huggingface:
embedding_hf_model_name: ${PGPT_EMBEDDING_HF_MODEL_NAME:BAAI/bge-small-en-v1.5}
embedding_hf_model_name: ${PGPT_EMBEDDING_HF_MODEL_NAME:nomic-ai/nomic-embed-text-v1.5}

sagemaker:
llm_endpoint_name: ${PGPT_SAGEMAKER_LLM_ENDPOINT_NAME:}
Expand Down
2 changes: 1 addition & 1 deletion settings-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ embedding:
mode: huggingface

huggingface:
embedding_hf_model_name: BAAI/bge-small-en-v1.5
embedding_hf_model_name: nomic-ai/nomic-embed-text-v1.5

vectorstore:
database: qdrant
Expand Down
2 changes: 1 addition & 1 deletion settings-vllm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ embedding:
ingest_mode: simple

huggingface:
embedding_hf_model_name: BAAI/bge-small-en-v1.5
embedding_hf_model_name: nomic-ai/nomic-embed-text-v1.5

openai:
api_base: http://localhost:8000/v1
Expand Down
4 changes: 2 additions & 2 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ embedding:
# Should be matching the value above in most cases
mode: huggingface
ingest_mode: simple
embed_dim: 384 # 384 is for BAAI/bge-small-en-v1.5
embed_dim: 768 # 768 is for nomic-ai/nomic-embed-text-v1.5

huggingface:
embedding_hf_model_name: BAAI/bge-small-en-v1.5
embedding_hf_model_name: nomic-ai/nomic-embed-text-v1.5
access_token: ${HF_TOKEN:}

vectorstore:
Expand Down
Loading