Instructions to use cmarkea/bloomz-3b-reranking with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cmarkea/bloomz-3b-reranking with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("cmarkea/bloomz-3b-reranking") model = AutoModelForSequenceClassification.from_pretrained("cmarkea/bloomz-3b-reranking") - Notebooks
- Google Colab
- Kaggle
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 |
)
|