Skip to content
Other

lcsh-decide-lora-onnx

проверка библиотечных предметных рубрик на CPU

2 min read

Набор LoRA-адаптеров (небольших надстроек над базовой моделью) и готовых ONNX-сборок на базе fastino/GLiNER2.5-Decide от автора DavidAtwood. Модель помогает проверять корректность построения предметных рубрик Библиотеки Конгресса США (LCSH): подходит ли подрубрика к основному заголовку, верно ли размечены географические и тематические деления и к какому типу относится сам заголовок. Автор позиционирует вывод модели не как окончательный приговор, а как сигнал для каталогизатора, на какие записи стоит обратить внимание в первую очередь. Пригодится специалистам по библиотечным системам, архивам и разработчикам пайплайнов валидации метаданных, которым нужно быстрое решение без GPU.

Ключевые особенности

  • Шесть задач в одном адаптере: проверка сочетаемости подрубрик на первой и последующих позициях, работа с редкими инструкциями, валидация географических цепочек, разделение «место или тема» и классификация типа заголовка.
  • Готовые ONNX-версии под CPU: в репозитории лежат полная сборка fp32 (1,693 MiB) и квантованная int8 (629 MiB), обе запускаются на обычном ноутбучном процессоре без видеокарты.
  • Калибровка уверенности: для int8-версии приложен файл calibration.json (температурное масштабирование и калибровка Платта), снижающий излишнюю самоуверенность оценок.
  • Открытая лицензия: адаптеры, ONNX-веса и примеры скриптов распространяются под Apache 2.0.

Что можно сделать

  • Автоматически отсеивать подозрительные комбинации рубрик и подрубрик при массовом импорте или ретроконверсии библиотечных каталогов.
  • Проверять правильность иерархии географических названий (например, отличать корректную цепочку страна–город от перевёрнутой) и корректность MARC-кодирования места ($z) и темы ($x).
  • Запускать проверку локально в фоновых скриптах на сервере или рабочем ноутбуке через onnxruntime без установки тяжеловесного PyTorch.

Пример

from gliner2 import AutoExtractor
from gliner2.training.lora import load_lora_adapter, merge_lora_weights

model = AutoExtractor.from_pretrained("fastino/GLiNER2.5-Decide").eval()
load_lora_adapter(model, "adapters/six-task")
merge_lora_weights(model)
tasks = {"coverage": {"labels": LABELS, "prompt": "Is the heading one of the kinds of heading named in the usage statement?"}}
model.batch_classify_text([text], tasks, batch_size=1, include_confidence=True)
ПодробнееКачество: на версии fp32 точность определения типа заголовка достигает 88.7%, AUC для первой подрубрики — 0.972, для разделения «место или тема» — 0.998.
Производительность (CPU, 4 потока): int8 обрабатывает строку за 69 мс (медиана) при пике памяти 1,703 MiB; fp32 — за 144 мс при 2,752 MiB.
Обучение: LoRA (r=16, alpha=32) на 68 303 строках из открытых авторитетных данных Библиотеки Конгресса, 2 эпохи на одной RTX 5070 (99 минут).
Ограничения: при калиброванном пороге 0.5 модель отлавливает 85% синтетических ошибок и помечает 2.6% валидных строк; версия int8 может ошибаться на перевёрнутых географических цепочках.
Discuss Telegram 0

Will it run?

Runs in F32

Fits without quantisation.

  • F32weights 3.5 GB · ready files4.3 GB
  • BF16weights 2.6 GB3.3 GB
  • FP8 / INT8recommendedweights 2.1 GB2.8 GB
  • 4-bitweights 1.9 GB2.6 GB

Tip: go 8-bit.FP8 / INT8 is within about a percent of full precision in quality, takes half the memory and runs faster on RTX 40/50 and H100. Full precision only pays off for fine-tuning.

What to get for this model

Massed ComputeOpen Massed Compute

Your own GPU: FP8 / INT8 — from RTX 2060 · F32 — from RTX 2060

Massed Compute hourly prices, November 2026. The discounted price applies with the coupon at checkout.

This is a LoRA: counted together with its base model GLiNER2.5-Decide.

Estimate: weights plus working memory. Long videos, high resolutions and long contexts need more.

Run it on Massed Compute

The script downloads the model to the rented machine. How to run it is in the model card.

  1. 1. Rent a machine with a fitting GPU

    Open Massed Compute
  2. 2. Paste the script into the machine's terminal

    Connect over SSH (the Massed Compute panel shows the command) or open a terminal on the machine's desktop.

    HF_TOKEN / CIVITAI_TOKENThe script starts with token lines: paste yours between the quotes. The Hugging Face token is for gated models, the Civitai one for Civitai models.

    # DavidAtwood/lcsh-decide-lora-onnx
    # ===== Tokens: paste yours between the quotes =====
    export HF_TOKEN=""        # huggingface.co/settings/tokens, for gated models
    # ==========================================
    mkdir -p ~/models
    curl -LsSf https://astral.sh/uv/install.sh | sh
    source "$HOME/.local/bin/env"
    uv tool install "huggingface_hub[cli]"
    hf download fastino/GLiNER2.5-Decide --local-dir ~/models/GLiNER2.5-Decide
    hf download DavidAtwood/lcsh-decide-lora-onnx --local-dir ~/models/lcsh-decide-lora-onnx
    # The model is in ~/models. How to run it is in the model card (link above).
    Add more LoRAs to GLiNER2.5-Decide
  3. 3. Use it

    The model is in ~/models. How to run it is in the model card (link above).

Stop the machine in the panel when you are done: it bills by the minute while it runs.

How to speed it up

Picked for this model type. Choose your hardware above to see what fits you exactly.

  • FlashAttention 44.0.0b40from November 18, 2026new release

    fastest exact attention on B200

    Kernels for Blackwell (beta). Exact attention without quantisation — fine for everything, LLMs included.

    How to enable: pip install flash-attn-4; vLLM and SGLang pick it up themselves.

    Earlier generations (2)
    • FlashAttention 3 — The Hopper (H100/H200) version with FP8.
    • FlashAttention 2 — The standard for RTX 30/40/50 and A100: exact attention without the memory cost of long contexts.
  • torch.compile2.15.0from October 28, 2026new release

    10–30% for free

    Compiles the model for your GPU. Slower first run, faster afterwards.

    How to enable: model = torch.compile(model); in ComfyUI the TorchCompileModel node.

Model family

Requires the base model

fastino/GLiNER2.5-Decide

This model is a LoRA / adapter. Download the base model first, then load this one on top.

  1. gliner2-large-v1family root
  2. GLiNER2.5-Decide
  3. lcsh-decide-lora-onnx

New posts about versions of gliner2-large-v1 (quants, finetunes, LoRAs) will show up under the bell.

Quantised versions 4All on Hugging Face
Fine-tunes 11All on Hugging Face
LoRAs and adapters 12All on Hugging Face

About the model

DavidAtwood/lcsh-decide-lora-onnx
Author
DavidAtwood
Category
Other
Released
Posted

On NeyroLearn

Hugging Face

00

Ask AI about this model

Answered by Gemini 4 · the chat is kept only in this tab

Comments