🚀 Italian Q&A Sentence Transformer
This model is designed for Italian question answering tasks, helping applications understand and process Italian queries to find relevant answer contexts.
🚀 Quick Start
This Italian Q&A Sentence Transformer is tailored for question answering in Italian. It maps sentences to a high - dimensional space to predict the most likely context containing the answer.
✨ Features
- Italian - Specific: Optimized for the Italian language, capable of handling its unique nuances.
- Transformer - Based: Utilizes a transformer architecture for effective text comprehension and analysis.
- Versatile Use Cases: Suitable for customer support automation, educational tools, and information retrieval systems.
📦 Installation
Install with SentenceTransformer
pip install -U sentence-transformers
💻 Usage Examples
Basic Usage
from transformers import AutoTokenizer, AutoModel
import torch
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessing import normalize
model_name = "DeepMount00/Anita"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name)
sentences = [
"Cosa faceva ogni sera Luca?",
"Un cane felice corre nel parco, la coda ondeggiante al vento. Ogni erba, ogni farfalla, un'avventura. Occhi scintillanti, lingua penzolante, esplora gioiosamente, amato e coccolato dal suo fedele compagno umano. Insieme, condividono un legame indissolubile, tessuto di corse, giochi e affetto incondizionato.",
"In un piccolo paesino circondato da colline verdeggianti e campi fioriti viveva una persona il cui sorriso era capace di illuminare la giornata più grigia. Questa persona, di nome Luca, aveva trovato la chiave della felicità nelle piccole gioie quotidiane: il profumo del caffè al mattino, il suono ridente dei bambini che giocavano in piazza, il tramonto che dipingeva il cielo di arancione e viola ogni sera."
]
embeddings = []
with torch.no_grad():
for sentence in sentences:
encoded_input = tokenizer(sentence, return_tensors='pt', padding=True, truncation=True, max_length=512)
embedding = model(**encoded_input).pooler_output
embeddings.append(embedding)
embeddings = torch.cat(embeddings, dim=0).numpy()
similarity_matrix = cosine_similarity(embeddings)
print("Similarità tra la sentenza 1 e 2:", similarity_matrix[0, 1])
print("Similarità tra la sentenza 1 e 3:", similarity_matrix[0, 2])
print("Similarità tra la sentenza 2 e 3:", similarity_matrix[1, 2])
Advanced Usage
from sentence_transformers import SentenceTransformer
sentences = ["Oggi sono andato al mare", "La torre di Pisa si trova in Toscana"]
model = SentenceTransformer('DeepMount00/Anita')
embeddings = model.encode(sentences)
print(embeddings)
📚 Documentation
Intended Use
This model is designed for the specific task of question answering (Q&A) in Italian. It is intended for applications that require understanding and processing Italian language queries to identify the most relevant context where an answer can be found. Suitable use cases include but are not limited to customer support automation, educational tools, and information retrieval systems.
Model Description
The Italian Q&A Sentence Transformer is trained to comprehend and analyze Italian text. Given a question, the model predicts the most probable context containing the answer by mapping sentences to a high - dimensional space. The model uses a transformer - based architecture, optimized specifically for the nuances of the Italian language.
📄 License
This model is released under the Apache 2.0 license.
Additional Information
- Version: 2
- Release Date: April 23, 2024
- Pipeline Tag: sentence - similarity