Downloads · 30 days
44
2% of all-time downloads
textplus-bbaw/transnormer-19c-beta-v02
transnormer-19c-beta-v02 is a text generation model from textplus-bbaw. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This model can normalize historical German spellings from the 19th century.
Downloads · 30 days
44
2% of all-time downloads
All-time downloads
2.6K
Public
Parameters
300M
3.6 GB on disk
Likes
2
Public
Click a slice to open those files.
.bin1.2 GB · 50%
From the Hugging Face model README
This model can normalize historical German spellings from the 19th century.
Transnormer is a byte-level sequence-to-sequence model for normalizing historical German text.
This model was trained on text from the 19th and late 18th century,
by performing a fine-tuning of google/byt5-small on the DTA reviEvalCorpus, a modified version of the DTA EvalCorpus (see section Training and evaluation data).
This model is intended for users that have a digitalized historical text and require normalization, that is, a version of the historical text that comes closer to modern spelling. Historical text typically contains spelling variations and extinct spellings that differ from contemporary text. This can be a drawback when working with historical text: Historical variation can impair the performance of NLP tools (POS tagging, etc.) that were trained on contemporary language, and full text search on historical texts can be tedious due to numerous spelling variants. Historical text normalization can mitigate these problems to some extent.
Note that this model is intended for the normalization of historical German text from a specific time period. It is not intended for other types of text that may require normalization (e.g. computer mediated communication), other languages than German or other periods of time. There may be other models available for these settings on the Hub.
This model can be further fine-tuned to be adapted or improved, as described in the transformers tutorials.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("ybracke/transnormer-19c-beta-v02")
model = AutoModelForSeq2SeqLM.from_pretrained("ybracke/transnormer-19c-beta-v02")
sentence = "Die Königinn ſaß auf des Pallaſtes mittlerer Tribune."
inputs = tokenizer(sentence, return_tensors="pt",)
outputs = model.generate(**inputs, num_beams=4, max_length=128)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
# >>> ['Die Königin saß auf des Palastes mittlerer Tribüne.']
Or use this model with the pipeline API like this:
from transformers import pipeline
transnormer = pipeline(model='ybracke/transnormer-19c-beta-v02')
sentence = "Die Königinn ſaß auf des Pallaſtes mittlerer Tribune."
print(transnormer(sentence, num_beams=4, max_length=128))
# >>> [{'generated_text': 'Die Königin saß auf des Palastes mittlerer Tribüne.'}]
The model was trained using a maximum input length of 512 bytes (~70 words). Inference on longer sequences is possible, but more error-prone than on shorter sequences. Moreover, inference on shorter sequences is faster and less computationally expensive. Consider splitting long sequences to process them separately. (Here is an example implementation).
The default generation configuration for this model limits the output length to 512 bytes.
To increase or decrease it, use the max_new_tokens parameter for generation.
For more details on how to customize generation, see the Hugging Face docs on generation strategies.
The model was fine-tuned and evaluated on the DTA reviEvalCorpus. DTA reviEvalCorpus is a parallel corpus of German texts from the period between 1780 to 1899, that aligns sentences in historical spelling of with their normalizations. The training set contains 96 documents with 4.6M source tokens, the dev and test set contain 13 documents (405K tokens) and 12 documents (381K tokens), respectively. For more information, see the dataset card of the corpus.
The following hyperparameters were used during training:
Yannic Bracke, Berlin-Brandenburg Academy of Sciences and Humanities
textplus (at) bbaw (dot) de