Update README.md
Browse files
README.md
CHANGED
@@ -76,9 +76,9 @@ def infer(txt: Union[str, List[str]]):
|
|
76 |
# Inportant: take only last token!
|
77 |
return embedding.get('last_hidden_state')[:,-1,:].numpy()
|
78 |
|
79 |
-
list_of_contexts = [...]
|
80 |
emb_contexts = infer(list_of_contexts)
|
81 |
-
list_of_queries = [...]
|
82 |
emb_queries = infer(list_of_queries)
|
83 |
|
84 |
# Important: take cosine distance!
|
@@ -104,9 +104,9 @@ retriever = pipeline('feature-extraction', 'cmarkea/bloomz-3b-retriever-v2')
|
|
104 |
# Inportant: take only last token!
|
105 |
infer = lambda x: [ii[0][-1] for ii in retriever(x)]
|
106 |
|
107 |
-
list_of_contexts = [...]
|
108 |
emb_contexts = np.concatenate(infer(list_of_contexts), axis=0)
|
109 |
-
list_of_queries = [...]
|
110 |
emb_queries = np.concatenate(infer(list_of_queries), axis=0)
|
111 |
|
112 |
# Important: take cosine distance!
|
|
|
76 |
# Inportant: take only last token!
|
77 |
return embedding.get('last_hidden_state')[:,-1,:].numpy()
|
78 |
|
79 |
+
list_of_contexts: List[str] = [...]
|
80 |
emb_contexts = infer(list_of_contexts)
|
81 |
+
list_of_queries: List[str] = [...]
|
82 |
emb_queries = infer(list_of_queries)
|
83 |
|
84 |
# Important: take cosine distance!
|
|
|
104 |
# Inportant: take only last token!
|
105 |
infer = lambda x: [ii[0][-1] for ii in retriever(x)]
|
106 |
|
107 |
+
list_of_contexts: List[str] = [...]
|
108 |
emb_contexts = np.concatenate(infer(list_of_contexts), axis=0)
|
109 |
+
list_of_queries: List[str] = [...]
|
110 |
emb_queries = np.concatenate(infer(list_of_queries), axis=0)
|
111 |
|
112 |
# Important: take cosine distance!
|