Update README.md
Browse files
README.md
CHANGED
@@ -98,7 +98,7 @@ The following example is based on the API Pipeline of the Transformers library.
|
|
98 |
from transformers import pipeline
|
99 |
|
100 |
reranker = pipeline(
|
101 |
-
task='
|
102 |
model='cmarkea/bloomz-3b-reranking',
|
103 |
top_k=None
|
104 |
)
|
@@ -116,11 +116,12 @@ similarities = reranker(
|
|
116 |
]
|
117 |
)
|
118 |
|
|
|
|
|
|
|
|
|
119 |
contexts_reranked = sorted(
|
120 |
-
|
121 |
-
lambda x: x[0]['label'] == "LABEL_1",
|
122 |
-
zip(similarities, contexts)
|
123 |
-
),
|
124 |
key=lambda x: x[0],
|
125 |
reverse=True
|
126 |
)
|
|
|
98 |
from transformers import pipeline
|
99 |
|
100 |
reranker = pipeline(
|
101 |
+
task='text-classification',
|
102 |
model='cmarkea/bloomz-3b-reranking',
|
103 |
top_k=None
|
104 |
)
|
|
|
116 |
]
|
117 |
)
|
118 |
|
119 |
+
score_label_1 = [
|
120 |
+
next(item['score'] for item in entry if item['label'] == 'LABEL_1')
|
121 |
+
for entry in similarities
|
122 |
+
]
|
123 |
contexts_reranked = sorted(
|
124 |
+
zip(score_label_1, contexts),
|
|
|
|
|
|
|
125 |
key=lambda x: x[0],
|
126 |
reverse=True
|
127 |
)
|