/ Модель

Характеристики

Контекст
514 токенов
Параметры
305 млн
Архитектура
xlm-roberta · dense
Базовая модель
afro-xlmr-base
Библиотека
transformers
Опубликована
13 сен 2026

hausa-agri-ner-candidate

Разметка токеновТекст → label3 профессии
19скачиваний за 30 дней1лайквеса обновлены13 сен 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Модель извлекает сущности, связанные с животноводством, из текстов на хауса и предназначена для помощи в разметке и анализе.

Модель Mustapha Idris для распознавания именованных сущностей в текстах на хауса о животноводстве. Это дообученная на базе Davlan/afro-xlmr-base модель XLM-RoBERTa для классификации токенов с 305,2 млн параметров и контекстом до 514 токенов. Она размечает сущности десяти типов, включая виды животных, породы, болезни, симптомы, лекарства и корма; использует схему из 21 BIO-метки. Поддерживает хауса, а также отдельные английские названия и сельскохозяйственные термины.

Модель предназначена для исследовательских задач, помощи в разметке и извлечения структурированной информации из текстов о скоте с последующей проверкой человеком. В карточке для этой версии указана тестовая entity F1 97,82% по предоставленным журналам обучения; результат независимо не воспроизводился. Данные преимущественно синтетические и дополнены проверенными владельцем проекта примерами. Лицензия для этой версии не указана. Модель не ставит диагнозы и не рекомендует лечение; качество на независимо собранных фермерских текстах, диалектах, незнакомых словах и ошибочных написаниях не проверено.

Сценарии применения

  • извлечение названий пород овец и коз из текстов на хауса
  • поиск упоминаний болезней и симптомов животных
  • извлечение названий лекарств и кормов из сельскохозяйственных сообщений
  • автоматическая предварительная разметка сущностей в корпусах на хауса
  • структурирование упоминаний видов скота в заметках о животноводстве

Ограничения

Тестовые примеры сильно пересекаются с обучающими по текстам сущностей, а для некоторых классов мало тестовых упоминаний; тестовый набор также не содержит предложений без сущностей. Результаты на независимо собранных данных, диалектных вариантах и ошибочных написаниях не проверены, поэтому извлечённые метки требуют человеческой проверки.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Hausa Agricultural Named Entity Recognition

A Hausa named entity recognition (NER) model fine-tuned from Davlan/afro-xlmr-base to identify livestock-related entities in text. It recognises ten entity types, including animal types, breeds, diseases, symptoms, medicines and feeds.

Version covered by this card: the retrained candidate using 1,636 training sentences. Its reported test entity F1 is 97.82%. These results describe the supplied training logs; they have not been independently reproduced. Before publishing this card, ensure the repository contains the corresponding retrained model and tokenizer rather than the original checkpoint.

Model details

  • Developed and shared by: Mustapha Idris (mustaphaidris).
  • Repository: mustaphaidris/hausa-agri-ner
  • Language: Hausa, with some English names and agricultural terminology.
  • Base checkpoint: Davlan/afro-xlmr-base
  • Architecture: XLMRobertaForTokenClassification; 12 layers, hidden size 768, 12 attention heads.
  • Task: token classification with 21 BIO labels: O and B-/I- tags for ten entity types.
  • License: not yet specified for this fine-tuned release.

Entity types

LabelScope and examples
ANIMAL_TYPESheep and goat expressions, such as rago, tunkiya and awaki
BREEDBreed designations, such as Balami, Yankasa, Red Sokoto, Sahel and Sahelian
DISEASENamed or explicitly reported conditions, such as FMD, tsutsar ciki and cutar huhu
SYMPTOMObserved signs, such as tari, zawo and wahalar numfashi
MEDICATIONNamed drugs, drug classes and therapeutic preparations, such as ivermectin and maganin tsutsar ciki
FEED_TYPENamed feeds and ingredients, such as dusa and kulin gyada
QUANTITYCounts and measurements, such as guda biyu and buhu shida
DATE_TIMEDates, relative times, durations, ages and frequencies
LOCATIONGeographic places and named farm spaces, such as Kano and pen 3
PERSONNELPersonal names and explicit farm-work roles, such as likitan dabbobi

B- starts an entity, I- continues it, and O indicates text outside the schema. The schema uses flat, non-overlapping spans. Body parts, equipment and management activities are outside its scope. In the reviewed supplement, generic vaccination activity expressions remain O; cutar huhu is treated as a complete reported disease expression. An extracted condition does not establish a diagnosis.

Training data

The original gold freeze, dated 9 September 2026, contains 2,000 sentences and 8,568 entity mentions. It uses one annotator's submitted labels as the project reference. “Gold” does not imply independent second annotation, veterinary validation or measured inter-annotator agreement.

The original corpus contains 1,700 source-linked examples, including earlier revisions, and 300 newly authored examples. It is an assisted/synthetic corpus, not 2,000 independently collected farm observations.

The retrained candidate adds 36 AI-authored sentences reviewed and approved by the project owner to the original training split. These additions target breed terminology, medication/feed distinctions, reported conditions and negative examples. Eight additions contain no entities.

SplitSentencesEntity mentions
Training, original1,6006,837
Reviewed training supplement3674
Training, combined1,6366,911
Validation200861
Test200870

Validation and test files remain unchanged. The expanded collection totals 2,036 sentences.

The original split groups recognised source-template descendants and similar entity-masked examples to reduce leakage. The split assignment uses seed 42 and no model scores, according to its release documentation. An audit found no shared source/group IDs or exact normalised sentence duplicates across the original splits. The supplement contains no case/punctuation-normalised duplicate sentences from those splits. These checks do not prove that all paraphrases or source dependencies are independent.

Training procedure

Words are tokenised into subwords. Only the first subword of each original word receives its BIO label; special tokens, padding and later subwords use -100 and do not contribute to the loss or reported metrics.

The notebook checks subword lengths and rejects oversized examples rather than silently truncating them. It validates token offsets, BIO labels and entity boundaries before training.

SettingValue
Learning rate0.00002
Epochs3
Training batch size per device8
Evaluation batch size per device8
Weight decay0.01
Evaluation and savingEvery epoch
Checkpoint selectionHighest validation F1
Completed training steps615

These settings come from the supplied notebook and retraining logs. Exact package versions and checkpoint revisions for the retrained run have not been separately verified.

Evaluation

The notebook computes entity precision, recall and F1 using seqeval through the evaluate library, after removing -100 positions. Accuracy measures token-label accuracy. The rebuilt notebook reports both default seqeval scores and strict IOB2 scores. Checkpoint selection uses default validation entity F1.

MetricFinal validationTest
Precision98.38%97.49%
Recall98.61%98.16%
Entity F198.49%97.82%
Strict IOB2 entity F198.54%97.81%
Token accuracy99.18%98.87%
Loss0.0380880.068946

Comparison with the original run

RunTraining sentencesValidation F1Test F1
Original1,60098.26%97.71%
Earlier expanded-data run1,63698.55%97.54%
Latest rebuilt-notebook run1,63698.49%97.82%

The latest run increased test F1 by approximately 0.11 percentage points relative to the original model. These are individual runs, not a controlled multiple-seed comparison; the difference does not establish statistical significance or overall superiority.

User-supplied development predictions showed Sahelian changing from MEDICATION to BREED, cutar huhu changing from fragmented labels to DISEASE, and rigakafi no longer receiving FEED_TYPE. These examples motivated the supplement, so they are development checks, not independent evidence of generalisation.

Confidence intervals, multiple-seed results and a separate natural-text evaluation have not yet been reported. The original held-out set has been inspected during development; further comparisons on it should be treated as benchmark comparisons rather than a fresh blind final evaluation.

Strict test results by entity type

Strict IOB2 evaluation requires matching entity boundaries and types. Support is the number of reference entities, not sentences.

Entity typePrecisionRecallF1Support
ANIMAL_TYPE98.84%98.84%98.84%173
BREED100.00%100.00%100.00%59
DATE_TIME95.51%91.40%93.41%93
DISEASE100.00%100.00%100.00%15
FEED_TYPE96.10%98.67%97.37%75
LOCATION98.03%100.00%99.00%149
MEDICATION100.00%100.00%100.00%80
PERSONNEL100.00%99.22%99.61%128
QUANTITY100.00%66.67%80.00%18
SYMPTOM92.86%97.50%95.12%80
Micro average97.93%97.70%97.81%870
Macro average98.13%95.23%96.34%870

Quantity is the weakest category: the model recovered 12 of 18 reference quantity entities under strict scoring. Perfect scores for some types apply only to this benchmark and do not establish perfect performance on unfamiliar text.

Usage

Use word boundaries consistent with the training data and retain only the first subword prediction per word. The tokenizer pattern below reproduced all saved tokens and character offsets in the original 2,000 examples. This validates compatibility with that corpus; it does not prove that the pattern handles every possible Hausa spelling convention.

The standard pipeline's simple aggregation can expose predictions from subwords ignored during training. Its first aggregation produced a word-boundary fallback warning in the supplied environment. The following helper avoids that aggregation heuristic and returns exact slices of the original text.

import re
import torch
from transformers import AutoTokenizer, AutoModelForTokenClassification

repo_id = "mustaphaidris/hausa-agri-ner"
tokenizer = AutoTokenizer.from_pretrained(repo_id, use_fast=True)
model = AutoModelForTokenClassification.from_pretrained(repo_id)
model.eval()

word_pattern = re.compile(r"['’ʼ]?\w+(?:['’ʼ-]\w+)*|[^\w\s]")

def extract_entities(text):
    words = list(word_pattern.finditer(text))
    if not words:
        return []

    batch = tokenizer(
        [word.group() for word in words],
        is_split_into_words=True,
        return_tensors="pt",
        truncation=False,
    )
    word_ids = batch.word_ids()
    # XLM-R position embeddings reserve positions for padding.
    position_limit = model.config.max_position_embeddings - model.config.pad_token_id - 1
    limit = min(tokenizer.model_max_length, position_limit)
    if batch["input_ids"].shape[1] > limit:
        raise ValueError("Input is too long; split it into shorter sentences.")

    device = next(model.parameters()).device
    with torch.no_grad():
        probs = model(**{k: v.to(device) for k, v in batch.items()}).logits[0].softmax(-1)

    spans, current, seen = [], None, set()
    for token_index, word_id in enumerate(word_ids):
        if word_id is None or word_id in seen:
            continue
        seen.add(word_id)
        score, label_id = probs[token_index].max(-1)
        tag = model.config.id2label[int(label_id)]
        if tag == "O":
            if current is not None:
                spans.append(current)
                current = None
            continue
        prefix, label = tag.split("-", 1)
        start, end = words[word_id].span()
        if prefix == "I" and current is not None and current["label"] == label:
            current["end"] = end
            current["scores"].append(float(score))
        else:
            if current is not None:
                spans.append(current)
            current = {"start": start, "end": end, "label": label, "scores": [float(score)]}
    if current is not None:
        spans.append(current)
    return [
        {"text": text[s["start"]:s["end"]], "label": s["label"],
         "start": s["start"], "end": s["end"],
         "score": sum(s["scores"]) / len(s["scores"])}
        for s in spans
    ]

print(extract_entities("Awaki irin Sahelian suna a Zaria."))

The helper starts a new span when an I- tag has no matching preceding entity. This is a display/decoding policy, not strict BIO validation. Scores average the selected first-subword probabilities and are not calibrated probabilities of correctness. The helper follows the rebuilt notebook’s word-alignment procedure. It has not been independently run against the uploaded Hub checkpoint.

Intended uses and limitations

Intended uses include research, annotation assistance and extracting structured information from Hausa livestock text with human review. This model does not generate answers, diagnose animals or recommend treatment.

  • Test vocabulary substantially overlaps training: 824 of 870 original test entity mentions have the same text and label in the original training set. All six distinct test breed forms and 31 medication forms occur in training.
  • Disease and quantity have only 15 and 18 test mentions respectively. Aggregate F1 can hide errors on these labels.
  • Validation and test contain no entity-free sentences. The expanded training set has nine, so false positives on unrelated text remain insufficiently evaluated.
  • Performance on independently collected farm text, dialect variations, unfamiliar names, spelling errors and longer documents remains unverified.
  • User-reviewed synthetic additions can retain linguistic or annotation mistakes. No independent agreement measurement is available.
  • The model can assign high confidence to an incorrect entity type. Human review remains necessary when using extracted information.

Release status

This card documents a retrained candidate. Confirm that the uploaded weights correspond to this run before using its results to describe the live repository. Dataset download links, a release license and a pinned model revision remain to be supplied.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · token-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
XLMRobertaForTokenClassification
Ревизия весов
50ff775

0 моделей