Update README.md
Browse files
README.md
CHANGED
@@ -60,19 +60,17 @@ Chuxin-Embedding 是专为增强中文文本检索能力而设计的嵌入模型
|
|
60 |
```python
|
61 |
#pip install -U FlagEmbedding
|
62 |
|
63 |
-
from FlagEmbedding import
|
64 |
|
65 |
-
model =
|
66 |
-
|
|
|
67 |
|
68 |
sentences_1 = ["样例数据-1", "样例数据-2"]
|
69 |
sentences_2 = ["样例数据-3", "样例数据-1"]
|
70 |
|
71 |
-
embeddings_1 = model.encode(sentences_1
|
72 |
-
|
73 |
-
max_length=1024,
|
74 |
-
)['dense_vecs']
|
75 |
-
embeddings_2 = model.encode(sentences_2)['dense_vecs']
|
76 |
similarity = embeddings_1 @ embeddings_2.T
|
77 |
print(similarity)
|
78 |
|
|
|
60 |
```python
|
61 |
#pip install -U FlagEmbedding
|
62 |
|
63 |
+
from FlagEmbedding import FlagModel
|
64 |
|
65 |
+
model = FlagModel('chuxin-llm/Chuxin-Embedding',
|
66 |
+
query_instruction_for_retrieval="为这个句子生成表示以用于检索相关文章:",
|
67 |
+
use_fp16=True)
|
68 |
|
69 |
sentences_1 = ["样例数据-1", "样例数据-2"]
|
70 |
sentences_2 = ["样例数据-3", "样例数据-1"]
|
71 |
|
72 |
+
embeddings_1 = model.encode(sentences_1)
|
73 |
+
embeddings_2 = model.encode(sentences_2)
|
|
|
|
|
|
|
74 |
similarity = embeddings_1 @ embeddings_2.T
|
75 |
print(similarity)
|
76 |
|