Instructions to use Dialogues/topos-facts-reader-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Dialogues/topos-facts-reader-v0.1 with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "question-answering" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("question-answering", model="Dialogues/topos-facts-reader-v0.1")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForQuestionAnswering tokenizer = AutoTokenizer.from_pretrained("Dialogues/topos-facts-reader-v0.1") model = AutoModelForQuestionAnswering.from_pretrained("Dialogues/topos-facts-reader-v0.1", device_map="auto") - Transformers.js
How to use Dialogues/topos-facts-reader-v0.1 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('question-answering', 'Dialogues/topos-facts-reader-v0.1'); - Notebooks
- Google Colab
- Kaggle
Topos Facts v0.1 · reader
Topos Facts reads one message and writes structured facts about its author, such as a goal, a move or a new job, across 27 fact packs. It uses two small encoders and no generative model.
This repo holds the reader: a DeBERTa-v3-large extractive question-answering model that fills the free-text fields of a fact by copying a span out of the message. It cannot write text that is not in the message. If no span clears its threshold, the field is left empty. The facts themselves are decided by the gate, Dialogues/topos-facts-gate-v0.1, whose card describes the whole pipeline, its evaluation and its limitations.
Try it: use the widget on this page with a question in the form below, or run the whole pipeline in the Dialogues/topos-facts Space.
Questions
The reader was trained on one question per free-text field:
What <field> of the author's <predicate> does the message state?, for exampleWhat destination of the author's trip does the message state?What does the message state about the author's <predicate>?, for single-value predicates such as medication or allergy.
All the questions are listed in topos_facts_spec.json in the gate repo. A span is kept when its start and end score
beats the "no answer" score by at least -6.0, it is at most 30 tokens long, and the input is capped at 512 tokens.
Usage
from transformers import pipeline
qa = pipeline("question-answering", model="Dialogues/topos-facts-reader-v0.1")
qa(question="What destination of the author's trip does the message state?",
context="Finally booked it: two weeks in Lisbon at the end of May.", handle_impossible_answer=True)
For the full gate-then-reader pipeline, use topos_facts.py from the gate repo.
In the browser
onnx/model_fp16.onnx is an fp16 ONNX export for transformers.js, which
is what the Space runs:
import { AutoModelForQuestionAnswering, AutoTokenizer } from "@huggingface/transformers";
const model = await AutoModelForQuestionAnswering.from_pretrained("Dialogues/topos-facts-reader-v0.1", { dtype: "fp16", device: "webgpu" });
With both models in fp16, the pipeline matches PyTorch on the gold set (1,079 of 1,080 pairs identical). There is no int8 export: quantizing to int8 moves the gate's scores far enough to break its 0.985–0.99 thresholds.
Training
- Base: deepset/deberta-v3-large-squad2 by deepset, licensed under CC-BY-4.0. This model is a fine-tuned derivative of it.
- Data: private and not released. A question's answer is the fact's value where the message contains it, and it is marked unanswerable where the value is only implied. No example on this page comes from the training data.
- Fine-tuning: AdamW at learning rate 1e-5, batch size 16, 512 tokens, 4 epochs, seed 13.
Licence and attribution
CC-BY-4.0, inherited from the base model. If you use or redistribute this model, credit deepset for deberta-v3-large-squad2 and Dialogues for this fine-tune, and link to the licence.
- Downloads last month
- 35
Model tree for Dialogues/topos-facts-reader-v0.1
Base model
deepset/deberta-v3-large-squad2