Skip to content

Commit 40638a1

Browse files
authored
fix: unify embedding models (#2027)
* feat: unify embedding model to nomic * docs: add embedding dimensions mismatch * docs: fix fern
1 parent 9027d69 commit 40638a1

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

fern/docs/pages/installation/troubleshooting.mdx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,22 @@ PrivateGPT uses the `AutoTokenizer` library to tokenize input text accurately. I
2828
```
2929
2. **Set Access Token for Gated Models:**
3030
If you are using a gated model, ensure the `access_token` is set as mentioned in the previous section.
31-
This configuration ensures that PrivateGPT can download and use the correct tokenizer for the model you are working with.
31+
This configuration ensures that PrivateGPT can download and use the correct tokenizer for the model you are working with.
32+
33+
# Embedding dimensions mismatch
34+
If you encounter an error message like `Embedding dimensions mismatch`, it is likely due to the embedding model and
35+
current vector dimension mismatch. To resolve this issue, ensure that the model and the input data have the same vector dimensions.
36+
37+
By default, PrivateGPT uses `nomic-embed-text` embeddings, which have a vector dimension of 768.
38+
If you are using a different embedding model, ensure that the vector dimensions match the model's output.
39+
40+
<Callout intent = "warning">
41+
In versions below to 0.6.0, the default embedding model was `BAAI/bge-small-en-v1.5` in `huggingface` setup.
42+
If you plan to reuse the old generated embeddings, you need to update the `settings.yaml` file to use the correct embedding model:
43+
```yaml
44+
huggingface:
45+
embedding_hf_model_name: BAAI/bge-small-en-v1.5
46+
embedding:
47+
embed_dim: 384
48+
```
49+
</Callout>

settings-docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ llamacpp:
1313
llm_hf_model_file: ${PGPT_HF_MODEL_FILE:Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf}
1414

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

1818
sagemaker:
1919
llm_endpoint_name: ${PGPT_SAGEMAKER_LLM_ENDPOINT_NAME:}

settings-local.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ embedding:
1818
mode: huggingface
1919

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

2323
vectorstore:
2424
database: qdrant

settings-vllm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ embedding:
1212
ingest_mode: simple
1313

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

1717
openai:
1818
api_base: http://localhost:8000/v1

settings.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ embedding:
7676
# Should be matching the value above in most cases
7777
mode: huggingface
7878
ingest_mode: simple
79-
embed_dim: 384 # 384 is for BAAI/bge-small-en-v1.5
79+
embed_dim: 768 # 768 is for nomic-ai/nomic-embed-text-v1.5
8080

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

8585
vectorstore:

0 commit comments

Comments
 (0)