Create README.md
Browse files## Installation
Install dependencies (now via our fork, wi'll update after PR)
```
pip install "gliner2 @ git+https://github.com/bogdanminko/GLiNER2.git@feature/bi-encoder" torch transformers
```
## Usage
Classify Harmful messages and Detect PII via single forward pass
```
from gliner2 import GLiNER2
model = GLiNER2.from_pretrained("raft-security-lab/gliner-guard-biencoder")
model.config.cache_labels = True
model.compile()
PII_LABELS = ["person", "location", "email", "phone"]
SAFETY_LABELS = ["safe", "unsafe"]
schema = (model.create_schema()
.entities(entity_types=PII_LABELS, threshold=0.4)
.classification(task="safety", labels=SAFETY_LABELS)
)
result = model.extract(
"Send $500 to John Smith at john.smith@gmail.com or I'll leak your photos",
schema=schema
)
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- ru
|
| 6 |
+
base_model:
|
| 7 |
+
- jhu-clsp/mmBERT-small
|
| 8 |
+
pipeline_tag: zero-shot-classification
|
| 9 |
+
tags:
|
| 10 |
+
- gliner2
|
| 11 |
+
- safety
|
| 12 |
+
- pii
|
| 13 |
+
- ai-security
|
| 14 |
+
- zero-shot
|
| 15 |
+
---
|