Views
No views yet
theoracle/11italian-sent model, a highly specialized tool designed for sentiment analysis in Italian. Built on the Gemma 2B architecture and fine-tuned with a diverse set of Italian texts, this model can accurately classify sentences into positive, neutral, or negative sentiments. Whether analyzing customer feedback, social media posts, or news headlines, this model offers deep insights into the emotional tone of Italian texts.1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_path = "theoracle/11italian-sent"
4tokenizer = AutoTokenizer.from_pretrained(model_path)
5model = AutoModelForCausalLM.from_pretrained(
6 model_path,
7 device_map="auto",
8 torch_dtype='auto'
9).eval()
10
11# Prepare your hotel review or any Italian text
12prompt = '''
13Analyze the sentiment of the hotel review enclosed in square brackets, determine if it is positive, neutral, or negative, and return the answer as the corresponding sentiment label "positive" or "neutral" or "negative" [Inserisci qui la tua recensione dell'hotel]
14'''
15
16# Tokenize and generate the response
17encoding = tokenizer(prompt, return_tensors='pt', padding=True, truncation=True, max_length=500, add_special_tokens=True)
18input_ids = encoding['input_ids']
19attention_mask = encoding['attention_mask']
20
21output_ids = model.generate(
22 input_ids.to('cuda'),
23 attention_mask=attention_mask.to('cuda'),
24 max_new_tokens=300,
25 pad_token_id=tokenizer.eos_token_id
26)
27
28response = tokenizer.decode(output_ids[0], skip_special_tokens=True)
29print(response)theoracle/11italian-sent is trained with AutoTrain, ensuring optimal training efficiency, and is built on the Gemma 2B architecture, known for its high performance in text generation and understanding tasks. The combination offers unparalleled accuracy and speed in processing Italian texts for sentiment analysis.