Model Card
The model is a sequence classifier, finetuned on a corpus of Italian literature sentences to identify representations of multilingualism.
Model Details
Model Description
With this model, we offer a tool capable of automatically extract from Italian literary texts those sentences that contain en explicit representation of multilingualism. This can help researchers interested in multilingualism and plurilingualism in the literary context.
- Developed by: Simone Rebora
- Model type: AutoModelForSequenceClassification
- Finetuned from: dbmdz/bert-base-italian-xxl-cased
- Repository: [More Information Needed]
- Paper: [More Information Needed]
How to Get Started with the Model
Use the code below to get started with the model.
Important The model does not include a tokenizer, we recomend using the one from dbmdz/bert-base-italian-xxl-cased.
# import libraries
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
# define function for prediction
def predict_text_class(input_text, labels, model, tokenizer):
input_ids = tokenizer(input_text, truncation=True, padding=True, return_tensors="pt")
# Perform inference
with torch.no_grad():
output = model(**input_ids)
predicted_labels = output.logits.argmax(dim=1)
return labels[predicted_labels.item()]
# Define the tokenizer
checkpoint = "dbmdz/bert-base-italian-xxl-cased"
# Define the path to your model
checkpoint_path = "<MODEL_PATH>"
# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
# Load the model
model_new = AutoModelForSequenceClassification.from_pretrained(checkpoint_path)
# define sentence and labels
sentence = "La lingua italiana e la lingua francese convivevano bene assieme"
labels = ['No', 'Sì']
# make a prediction
predict_text_class(sentence, labels=labels, model=model_new, tokenizer=tokenizer)
Training Details
Training Data
[More Information Needed]
Training Hyperparameters
train_ratio = 0.8 validation_ratio = 0.2 batch_size: 16 num_train_epochs=3 metric_for_best_model='accuracy' weight_decay=0.01
Evaluation
precision recall f1-score support
No 0.97 0.89 0.93 302
Sì 0.83 0.96 0.89 167
accuracy 0.91 469
macro avg 0.90 0.92 0.91 469
weighted avg 0.92 0.91 0.92 469
Citation
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
- Downloads last month
- -
Model tree for srebora/MultItLit
Base model
dbmdz/bert-base-italian-xxl-cased