Downloads · 30 days
23
2% of all-time downloads
alexandrainst/da-ned-base
da-ned-base is a text classification model from alexandrainst. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
Given a sentence and a knowledge graph context, the model detects whether a specific entity (represented by the knowledge graph context) is mentioned in the sentence (binary classification). The base language model us…
Downloads · 30 days
23
2% of all-time downloads
All-time downloads
1.2K
Public
Parameters
278M
3.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.h51.1 GB · 33%
How the weights are stored.
F32278M · 100%
From the Hugging Face model README
Given a sentence and a knowledge graph context, the model detects whether a specific entity (represented by the knowledge graph context) is mentioned in the sentence (binary classification). The base language model used is the xlm-roberta-base.
Here is how to use the model:
from transformers import XLMRobertaTokenizer, XLMRobertaForSequenceClassification
model = XLMRobertaForSequenceClassification.from_pretrained("alexandrainst/da-ned-base")
tokenizer = XLMRobertaTokenizer.from_pretrained("alexandrainst/da-ned-base")
The tokenizer takes 2 strings has input: the sentence and the knowledge graph (KG) context. Here is an example:
sentence = "Karen Blixen vendte tilbage til Danmark, hvor hun boede resten af sit liv på Rungstedlund, som hun arvede efter sin mor i 1939"
kg_context = "udmærkelser modtaget Kritikerprisen udmærkelser modtaget Tagea Brandts Rejselegat udmærkelser modtaget Ingenio et arti udmærkelser modtaget Holbergmedaljen udmærkelser modtaget De Gyldne Laurbær mor Ingeborg Dinesen ægtefælle Bror von Blixen-Finecke køn kvinde Commons-kategori Karen Blixen LCAuth no95003722 VIAF 90663542 VIAF 121643918 GND-identifikator 118637878 ISNI 0000 0001 2096 6265 ISNI 0000 0003 6863 4408 ISNI 0000 0001 1891 0457 fødested Rungstedlund fødested Rungsted dødssted Rungstedlund dødssted København statsborgerskab Danmark NDL-nummer 00433530 dødsdato +1962-09-07T00:00:00Z dødsdato +1962-01-01T00:00:00Z fødselsdato +1885-04-17T00:00:00Z fødselsdato +1885-01-01T00:00:00Z AUT NKC jn20000600905 AUT NKC jo2015880827 AUT NKC xx0196181 emnets hovedkategori Kategori:Karen Blixen tilfælde af menneske billede Karen Blixen cropped from larger original.jpg IMDb-identifikationsnummer nm0227598 Freebase-ID /m/04ymd8w BNF 118857710 beskæftigelse skribent beskæftigelse selvbiograf beskæftigelse novelleforfatter ..."
A KG context, for a specific entity, can be generated from its Wikidata page. In the previous example, the KG context is a string representation of the Wikidata page of Karen Blixen (QID=Q182804). See the DaNLP documentation for more details about how to generate a KG context.
The model has been trained on the DaNED and DaWikiNED datasets.