German Twitter stance detection with BERT on the Russo-Ukrainian conflict

This model was trained for stance detection of German language Tweets. It was fine-tuned on the dbmdz/bert-base-german-uncased in a cross-target training setting on the following four topics that have been discussed by German Twitter users in the context of the conflict:

  • Arms Delivery (AD): Delivery of (heavy) arms to Ukraine
  • NPPs Operation Continuation (NOC): Repeal of the planned nuclear phase-out by the end of 2022 and the continuation of nuclear power plant operations in Germany
  • Speed Limit Implementation (SLI): Implementation of a temporary speed limit on German highways
  • Ukraine Support (US): General support of Ukraine in the ongoing Russian-Ukrainian conflict 2022

Dataset and preprocessing

The model was trained in total on 29,076 German-language Tweet samples related to the four topics. To achieve the best results, it is recommended to preprocess inputs with the same procedure that was applied during training. The model receives as input the topic formulated as a question along with the corresponding tweet: target question [SEP] tweet. Note: The model was created as part of a student project. If interested in data and code, see this repository.

Preview using Pipeline

from transformers import AutoTokenizer, AutoModelForSequenceClassification
from transformers import pipeline

model_name = "joh-ga/german-tweetstance-bert-uncased-russiaukrainewar"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)

texts = [
    "soll die ukraine im fortlaufenden konflikt mit russland grundsätzlich unterstützt werden [SEP] das ist nicht unser krieg und diese nationalen werte der ukraine sind auch nicht unsere",
    "soll die ukraine im fortlaufenden konflikt mit russland grundsätzlich unterstützt werden [SEP] mir fehlen die worte zu den greueltaten in der ukraine stop the war wir stehen an eurer seite ukraine",
    "soll die ukraine mit der lieferung von waffen sowie von schweren waffen unterstützt werden [SEP] verdammt noch mal mehr waffen haben noch nie einen krieg beendet friedengespräche jetzt",
    "soll die ukraine mit der lieferung von waffen sowie von schweren waffen unterstützt werden [SEP] schickt endlich mehr waffen in die ukraine",
    "soll der geplante atomausstieg zum jahresende 2022 aufgehoben und atomkraftwerke weiterbetrieben werden [SEP] es ist mir peinlich dass die eu weiterhin fossiles gas und atomenergie als nachhaltige energien fördern will",
    "soll der geplante atomausstieg zum jahresende 2022 aufgehoben und atomkraftwerke weiterbetrieben werden [SEP] ja wir brauchen atomkraftwerke und keinen atomausstieg",
    "soll auf deutschen autobahnen ein zeitlich befristetes tempolimit eingeführt werden [SEP] ein tempolimit bringt neue gefahren mit sich daher ist es gut dass wir kein tempolimit haben die unfallzahlen belegen das",
    "soll auf deutschen autobahnen ein zeitlich befristetes tempolimit eingeführt werden [SEP] auf abschnitten mit tempolimit sterben weniger menschen in deutschland"]

classifier(texts)

Output:

[{'label': 'against', 'score': 0.9645096063613892},
 {'label': 'favor', 'score': 0.9337254166603088},
 {'label': 'against', 'score': 0.9790647029876709},
 {'label': 'favor', 'score': 0.9716084599494934},
 {'label': 'against', 'score': 0.990142822265625},
 {'label': 'favor', 'score': 0.8662880063056946},
 {'label': 'against', 'score': 0.8250468969345093},
 {'label': 'favor', 'score': 0.7044461965560913}]
Downloads last month
30