Views
No views yet
ai4data dataset extraction pipeline, helping skip pages/documents that do not contain dataset references before performing detailed entity and relation extraction.fastino/gliner2-large-v1has_data_mention["has_mention", "no_mention"]gliner2 and the PeftModel interface:1from gliner2 import GLiNER2
2from peft import PeftModel
3
4# Load base model and apply adapter
5base_model = GLiNER2.from_pretrained("fastino/gliner2-large-v1")
6model = PeftModel.from_pretrained(base_model, "ai4data/datause-classifier")
7model.eval()
8
9# Define classification tasks
10TASKS = {"has_data_mention": ["has_mention", "no_mention"]}
11
12text_with_data = "This paper uses microdata from the 2018 Nigeria General Household Survey."
13text_no_data = "The project will strengthen institutional capacity and governance frameworks."
14
15# Run inference
16res1 = model.classify_text(text_with_data, TASKS, threshold=0.0, include_confidence=True)
17print(res1)
18# Output: {'has_data_mention': {'label': 'has_mention', 'confidence': 1.0}}
19
20res2 = model.classify_text(text_no_data, TASKS, threshold=0.0, include_confidence=True)
21print(res2)
22# Output: {'has_data_mention': {'label': 'no_mention', 'confidence': 0.998}}