This gBert-base model was finetuned on a sentiment prediction task with tweets from German politician during the German Federal Election in 2021.
Model Description:
This model was trained on ~30.000 annotated tweets in German language on its sentiment. It can predict tweets as negative, positive or neutral. It achieved an accuracy of 93% on the specific dataset.
Model Implementation
You can implement this model for example with Simpletransformers. First you have to unpack the file.
def unpack_model(model_name=''):
tar = tarfile.open(f"{model_name}.tar.gz", "r:gz")
tar.extractall()
tar.close()
The hyperparameter were defined as follows:
train_args ={"reprocess_input_data": True,
"fp16":False,
"num_train_epochs": 4,
"overwrite_output_dir":True,
"train_batch_size": 32,
"eval_batch_size": 32}
Now create the model:
unpack_model(YOUR_DOWNLOADED_FILE_HERE)
model = ClassificationModel(
"bert", "content/outputs/",
num_labels= 3,
args=train_args
)
In this case for the output:
0 = positive
1 = negative
2 = neutral
Example for a positive prediction:
model.predict(["Das ist gut! Wir danken dir."])
([0], array([[ 2.06561327, -3.57908797, 1.5340755 ]]))