Text Generation
PEFT
Safetensors
German

Model Card for Model German4All

This model can paraphrase German texts into different complexity levels and perform simplification and complexification at the same time. For more details about the setup, visit our GitHub repository.

Usage

from peft import PeftModel
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

model_name = "tum-nlp/single_model_xl"
base_model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-xl")
model = PeftModel.from_pretrained(base_model, model_name).to(base_model.device)
tokenizer = AutoTokenizer.from_pretrained(model_name)

description = """Verwandle den folgenden Text in die Zielsprachebene gemäß den untenstehenden Beschreibungen.
KOMPLEXITÄTSBESCHREIBUNGEN
Level 1 : Leichte Sprache:
Zielgruppe: Zielgruppe: Personen mit Leseschwierigkeiten, inklusive Menschen mit Lernbehinderungen und solche, die erst kürzlich begonnen haben, Deutsch zu lernen.
Merkmale: Sehr kurze Sätze, nur kurze und häufig verwendete Wörter, direkte Ansprache. Vermeidung von Abkürzungen, Metaphern oder Ironie.
Beispiele: Einfache Anleitungen, barrierefreie Webseiten.

Level 2 : Einfaches Deutsch für Anfänger:
Zielgruppe: Nicht-Muttersprachler mit grundlegenden Deutschkenntnissen.
Merkmale: Einfache Satzstrukturen, Grundwortschatz, klarer Fokus auf wichtige Informationen, Vermeidung kulturspezifischer Ausdrücke.
Beispiele:  Sprachlernmaterialien, einführende Webtexte.

Level 3 : Gebräuchliche Standardsprache:
Zielgruppe: Öffentlichkeit mit unterschiedlichem Bildungsniveau.
Merkmale: Klare, strukturierte Sätze, Verständlichkeit steht im Vordergrund, Vermeidung von Fachjargon.
Beispiele: Breit gefächerte Nachrichtenportale, Blogs.

Level 4 : Gehobene Alltagssprache:
Zielgruppe: Regelmäßige Leser mit gutem Sprachverständnis.
Merkmale: Vielfältigeres Vokabular, gelegentlicher Fachjargon mit Erklärungen, komplexe Satzstrukturen.
Beispiele: Fachblogs, Qualitätszeitungen.

Level 5 : Akademische Sprache:
Zielgruppe: Akademiker und Experten.
Merkmale: Komplexe Satzstrukturen, Fachterminologie, Verwendung von Fachbegriffen.
Beispiele: Fachzeitschriften, wissenschaftliche Publikationen.
"""

input_text = "Ein beliebter Badeort mit vielen Stränden und Wassersport ist Deutschlands größter See , der Bodensee , ganz im Süden ."

# TODO: Define your target level
level = 1
prefix = f"\n Paraphrasiere den folgenden Text auf Level {level}.\n Text: "
input_full = [description + prefix.format(level=level) + input_text]
model_inputs = tokenizer(input_full, max_length=512, truncation=True, padding="max_length",
                         return_tensors="pt").to(model.device)
eval_preds = model.generate(**model_inputs, do_sample=True, top_p=0.9, temperature=0.1,
                          max_new_tokens=256)
output_preds = tokenizer.batch_decode(eval_preds, skip_special_tokens=True)[0]
print(f"Output to level {level}:", output_preds)

# prints "Output to level 1: In Deutschland gibt es einen großen See. Der Bodensee ist sehr groß. Viele Menschen gehen dort zum Baden."

Complexity Levels

English translation of the complexity levels we used for the synthetic data generation:

  1. Leichte Sprache Plus (literal translation: Easy Language Plus)
    • Target group: People with reading difficulties, including people with learning disabilities and those who have only recently started to learn German.
    • Characteristics: Very short sentences, only short and frequently used words, direct speech, avoidance of abbreviations, metaphors, or irony.
    • Example areas: simple instructions, accessible websites.
  2. Simple German for beginners
    • Target group: Non-native speakers with basic knowledge of German.
    • Characteristics: Simple sentence structures, basic vocabulary, strong focus on important information, avoidance of culture-specific expressions.
    • Example areas: Language learning materials, introductory web texts.
  3. Commonly used language
    • Target group: General public with different levels of education.
    • Characteristics: Clear, structured sentences, focus on comprehensibility, avoidance of technical terms.
    • Example areas: Wide-ranging news portals, blogs.
  4. Elevated everyday language
    • Target group: Regular readers with a good understanding of the language.
    • Characteristics: More varied vocabulary, occasional technical terminology with explanations, complex sentence structures.
    • Example areas: Specialist blogs, quality newspapers.
  5. Academic language
    • Target group: Academics and experts.
    • Characteristics: Complex sentence structures, specialized terminology, use of technical terms.
    • Example areas: Specialist journals, scientific publications.

Citation Information

If you use any of our artifacts, please cite the following paper: [TBD after publishing]

Downloads last month
38
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for tum-nlp/German4all-paraphrasing-xl

Base model

google/flan-t5-xl
Adapter
(44)
this model

Dataset used to train tum-nlp/German4all-paraphrasing-xl

Collection including tum-nlp/German4all-paraphrasing-xl