datause-classifier / README.md
rafmacalaba's picture
Upload README.md with huggingface_hub
5c686fc verified
|
Raw
History Blame Contribute Delete
1.93 kB
---
base_model: fastino/gliner2-large-v1
library_name: peft
tags:
- base_model:adapter:fastino/gliner2-large-v1
- lora
- transformers
- text-classification
- gliner
---
# Dataset Mention Classification Model
This is a fine-tuned sequence classification model for identifying the presence of dataset mentions in text. It is built as a LoRA adapter on top of the [fastino/gliner2-large-v1](https://huggingface.co/fastino/gliner2-large-v1) base model.
It serves as the default pre-filtering stage (page-relevance classifier) in the `ai4data` dataset extraction pipeline, helping skip pages/documents that do not contain dataset references before performing detailed entity and relation extraction.
## Model Details
- **Base Model:** `fastino/gliner2-large-v1`
- **Adapter Type:** PEFT / LoRA
- **Task:** Sequence Classification
- **Task Name:** `has_data_mention`
- **Labels:** `["has_mention", "no_mention"]`
## How to Use
You can load and use this model directly via `gliner2` and the `PeftModel` interface:
```python
from gliner2 import GLiNER2
from peft import PeftModel
# Load base model and apply adapter
base_model = GLiNER2.from_pretrained("fastino/gliner2-large-v1")
model = PeftModel.from_pretrained(base_model, "ai4data/datause-classifier")
model.eval()
# Define classification tasks
TASKS = {"has_data_mention": ["has_mention", "no_mention"]}
text_with_data = "This paper uses microdata from the 2018 Nigeria General Household Survey."
text_no_data = "The project will strengthen institutional capacity and governance frameworks."
# Run inference
res1 = model.classify_text(text_with_data, TASKS, threshold=0.0, include_confidence=True)
print(res1)
# Output: {'has_data_mention': {'label': 'has_mention', 'confidence': 1.0}}
res2 = model.classify_text(text_no_data, TASKS, threshold=0.0, include_confidence=True)
print(res2)
# Output: {'has_data_mention': {'label': 'no_mention', 'confidence': 0.998}}
```