Update model card: add zen/zenlm tags, fix branding
Browse files
README.md
CHANGED
|
@@ -1,47 +1,65 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
tags:
|
| 5 |
-
- reranker
|
| 6 |
- text-classification
|
| 7 |
-
- retrieval
|
| 8 |
-
- multilingual
|
| 9 |
- zen
|
| 10 |
-
-
|
| 11 |
- hanzo
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
# Zen3 Reranker Medium
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|----------|-------|
|
| 23 |
-
| Parameters | 560M |
|
| 24 |
-
| Context Length | 512 tokens |
|
| 25 |
-
| Architecture | Zen MoDE (Mixture of Distilled Experts) |
|
| 26 |
-
| Generation | Zen3 |
|
| 27 |
|
| 28 |
-
##
|
| 29 |
|
| 30 |
```python
|
| 31 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
tokenizer =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
```
|
| 36 |
|
| 37 |
-
##
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
## License
|
| 42 |
|
| 43 |
Apache 2.0
|
| 44 |
-
|
| 45 |
-
---
|
| 46 |
-
|
| 47 |
-
*Zen LM is developed by [Hanzo AI](https://hanzo.ai) — Frontier AI infrastructure.*
|
|
|
|
| 1 |
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
tags:
|
|
|
|
| 5 |
- text-classification
|
|
|
|
|
|
|
| 6 |
- zen
|
| 7 |
+
- zenlm
|
| 8 |
- hanzo
|
| 9 |
+
- zen3
|
| 10 |
+
- reranker
|
| 11 |
+
- retrieval
|
| 12 |
+
pipeline_tag: text-classification
|
| 13 |
+
library_name: transformers
|
| 14 |
---
|
| 15 |
|
| 16 |
# Zen3 Reranker Medium
|
| 17 |
|
| 18 |
+
Medium-sized Zen3 reranker for higher accuracy re-scoring in RAG pipelines.
|
| 19 |
+
|
| 20 |
+
## Overview
|
| 21 |
|
| 22 |
+
Built on **Zen MoDE (Mixture of Distilled Experts)** architecture with 1.5B parameters and 8K context window.
|
| 23 |
|
| 24 |
+
Developed by [Hanzo AI](https://hanzo.ai) and the [Zoo Labs Foundation](https://zoo.ngo).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
## Quick Start
|
| 27 |
|
| 28 |
```python
|
| 29 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 30 |
+
import torch
|
| 31 |
+
|
| 32 |
+
model_id = "zenlm/zen3-reranker-medium"
|
| 33 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 34 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_id, torch_dtype="auto")
|
| 35 |
+
|
| 36 |
+
query = "What is machine learning?"
|
| 37 |
+
passages = [
|
| 38 |
+
"Machine learning is a subset of artificial intelligence...",
|
| 39 |
+
"The weather today is sunny and warm.",
|
| 40 |
+
"Neural networks learn from labeled training data.",
|
| 41 |
+
]
|
| 42 |
|
| 43 |
+
pairs = [[query, p] for p in passages]
|
| 44 |
+
features = tokenizer(pairs, padding=True, truncation=True, max_length=512, return_tensors="pt")
|
| 45 |
+
|
| 46 |
+
with torch.no_grad():
|
| 47 |
+
scores = model(**features).logits.squeeze(-1)
|
| 48 |
+
|
| 49 |
+
ranked = sorted(zip(scores.tolist(), passages), reverse=True)
|
| 50 |
+
for score, passage in ranked:
|
| 51 |
+
print(f"Score: {score:.4f} | {passage[:80]}")
|
| 52 |
```
|
| 53 |
|
| 54 |
+
## Model Details
|
| 55 |
|
| 56 |
+
| Attribute | Value |
|
| 57 |
+
|-----------|-------|
|
| 58 |
+
| Parameters | 1.5B |
|
| 59 |
+
| Architecture | Zen MoDE |
|
| 60 |
+
| Context | 8K tokens |
|
| 61 |
+
| License | Apache 2.0 |
|
| 62 |
|
| 63 |
## License
|
| 64 |
|
| 65 |
Apache 2.0
|
|
|
|
|
|
|
|
|
|
|
|