Downloads · 30 days
29
1% of all-time downloads
strombergnlp/dant5-small
dant5-small is a machine learning model from strombergnlp. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
--- language: - da languagebcp47: - da - da-bornholm - da-synnejyl tags: - t5 license: cc-by-4.0 datasets: - dagw widget: - text: "Aarhus er Danmarks <extraid0.<extraid2" co2eqemissions: trainingtype: "pretraining" ge…
Downloads · 30 days
29
1% of all-time downloads
All-time downloads
3.2K
Public
Parameters
60.5M
485 MB on disk
Likes
4
Public
Click a slice to open those files.
.bin242 MB · 50%
From the Hugging Face model README
language:
dant5-small is a 60M parameter model with architecture identical to t5-small. Training details are given in the paper Training a T5 Using Lab-sized Resources. It was trained for 10 epochs on the Danigh GigaWord Corpus (official website, paper).
from transformers import AutoTokenizer, T5ForConditionalGeneration
model_name = "strombergnlp/dant5-small"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)
original_text = "Aarhus er Danmarks <extra_id_0> landets ældste. Under navnet Aros, som betyder å-munding, optræder den i skriftlige kilder i 900-tallet, men <extra_id_1> historie tilbage til 700-tallet.<extra_id_2>"
original_label = "<extra_id_0> næststørste by og en af <extra_id_1> arkæologiske fund fører dens <extra_id_2>"
input_ids = tokenizer(original_text, return_tensors="pt").input_ids
labels = tokenizer(original_label, return_tensors="pt").input_ids
loss = model(input_ids=input_ids, labels=labels).loss
print(f"Original text: {original_text}")
print(f"Original label: {original_label}")
print(f"Loss for the original label is {loss.item()}")
sequence_ids = model.generate(input_ids)
sequences = tokenizer.batch_decode(sequence_ids)
print(f"A sample generated continuation: ")
print(sequences[0])
You should see output similar to:
Original text: Aarhus er Danmarks <extra_id_0> landets ældste. Under navnet Aros, som betyder å-munding, optræder den i skriftlige kilder i 900-tallet, men <extra_id_1> historie tilbage til 700-tallet.<extra_id_2>
Original label: <extra_id_0> næststørste by og en af <extra_id_1> arkæologiske fund fører dens <extra_id_2>
Loss for the original label is 3.383681297302246
A sample generated continuation:
<pad><extra_id_0> ældste og<extra_id_1> har sin<extra_id_2> Aarhus er Danmarks ældste<extra_id_3></s>