Fix typos
Browse files
README.md
CHANGED
@@ -2678,10 +2678,10 @@ similarity = embedding1 @ embedding2.T
|
|
2678 |
print(similarity)
|
2679 |
```
|
2680 |
|
2681 |
-
Using pre-defined [SionicEmbeddingModel]() to obtain embeddings.
|
2682 |
|
2683 |
```python
|
2684 |
-
import SionicEmbeddingModel
|
2685 |
|
2686 |
inputs1 = ["first query", "second query"]
|
2687 |
inputs2 = ["third query", "fourth query"]
|
@@ -2692,20 +2692,20 @@ embedding2 = model.encode(inputs2)
|
|
2692 |
similarity = embedding1 @ embedding2.T
|
2693 |
print(similarity)
|
2694 |
```
|
2695 |
-
Inspired by [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding), we
|
2696 |
-
By using `encode_queries()`, you can use instruction to encode queries which is
|
2697 |
The instruction to use for both v1 and v2 models is `"query: "`.
|
2698 |
|
2699 |
```python
|
2700 |
-
import SionicEmbeddingModel
|
2701 |
|
2702 |
query = ["first query", "second query"]
|
2703 |
passage = ["This is a passage related to the first query", "This is a passage related to the second query"]
|
2704 |
model - SionicEmbeddingModel(url="https://api.sionic.ai/v1/embedding",
|
2705 |
instruction="query: ",
|
2706 |
dimension=2048)
|
2707 |
-
query_embedding = model.
|
2708 |
-
passage_embedding = model.
|
2709 |
similarity = query_embedding @ passage_embedding.T
|
2710 |
print(similarity)
|
2711 |
```
|
|
|
2678 |
print(similarity)
|
2679 |
```
|
2680 |
|
2681 |
+
Using pre-defined [SionicEmbeddingModel](https://huggingface.co/sionic-ai/sionic-ai-v1/blob/main/model_api.py) to obtain embeddings.
|
2682 |
|
2683 |
```python
|
2684 |
+
from model_api import SionicEmbeddingModel
|
2685 |
|
2686 |
inputs1 = ["first query", "second query"]
|
2687 |
inputs2 = ["third query", "fourth query"]
|
|
|
2692 |
similarity = embedding1 @ embedding2.T
|
2693 |
print(similarity)
|
2694 |
```
|
2695 |
+
Inspired by [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding), we apply the instruction to encode short queries for retrieval tasks.
|
2696 |
+
By using `encode_queries()`, you can use instruction to encode queries which is prefixed to each query.
|
2697 |
The instruction to use for both v1 and v2 models is `"query: "`.
|
2698 |
|
2699 |
```python
|
2700 |
+
from model_api import SionicEmbeddingModel
|
2701 |
|
2702 |
query = ["first query", "second query"]
|
2703 |
passage = ["This is a passage related to the first query", "This is a passage related to the second query"]
|
2704 |
model - SionicEmbeddingModel(url="https://api.sionic.ai/v1/embedding",
|
2705 |
instruction="query: ",
|
2706 |
dimension=2048)
|
2707 |
+
query_embedding = model.encode_queries(query)
|
2708 |
+
passage_embedding = model.encode_corpus(passage)
|
2709 |
similarity = query_embedding @ passage_embedding.T
|
2710 |
print(similarity)
|
2711 |
```
|