theoracle commited on
Commit
db3ce5e
1 Parent(s): afbbc94

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +51 -22
README.md CHANGED
@@ -1,29 +1,35 @@
1
  ---
 
2
  tags:
 
 
3
  - autotrain
4
- - text-generation-inference
5
- - text-generation
6
- - peft
7
  library_name: transformers
8
- widget:
9
- - messages:
10
- - role: user
11
- content: What is your favorite condiment?
12
  license: other
13
  ---
14
 
15
- # Model Trained Using AutoTrain
16
 
17
- This model was trained using AutoTrain. For more information, please visit [AutoTrain](https://hf.co/docs/autotrain).
18
 
19
- # Usage
20
 
21
- ```python
 
 
22
 
23
- from transformers import AutoModelForCausalLM, AutoTokenizer
 
 
24
 
25
- model_path = "PATH_TO_THIS_REPO"
 
26
 
 
27
  tokenizer = AutoTokenizer.from_pretrained(model_path)
28
  model = AutoModelForCausalLM.from_pretrained(
29
  model_path,
@@ -31,15 +37,38 @@ model = AutoModelForCausalLM.from_pretrained(
31
  torch_dtype='auto'
32
  ).eval()
33
 
34
- # Prompt content: "hi"
35
- messages = [
36
- {"role": "user", "content": "hi"}
37
- ]
 
 
 
 
 
38
 
39
- input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')
40
- output_ids = model.generate(input_ids.to('cuda'))
41
- response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
 
 
 
42
 
43
- # Model response: "Hello! How can I assist you today?"
44
  print(response)
45
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Gemma 2B Italian Sentiment Analysis Model
3
  tags:
4
+ - sentiment-analysis
5
+ - italian
6
  - autotrain
7
+ - gemma-2b
8
+ datasets:
9
+ - custom
10
  library_name: transformers
11
+ model: theoracle/11italian-sent
 
 
 
12
  license: other
13
  ---
14
 
15
+ ## Overview
16
 
17
+ Introducing the `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.
18
 
19
+ ## Key Features
20
 
21
+ - **Tailored for Italian Text**: Optimized to understand the nuances and complexities of the Italian language.
22
+ - **Comprehensive Sentiment Analysis**: Categorizes text into positive, neutral, or negative sentiments with high accuracy.
23
+ - **Powered by Gemma 2B and AutoTrain**: Utilizes the Gemma 2B architecture for advanced text processing and is trained using Hugging Face's AutoTrain for maximum efficiency.
24
 
25
+ ## Usage
26
+
27
+ Here's how to utilize this model for sentiment analysis on Italian text:
28
 
29
+ ```python
30
+ from transformers import AutoModelForCausalLM, AutoTokenizer
31
 
32
+ model_path = "theoracle/11italian-sent"
33
  tokenizer = AutoTokenizer.from_pretrained(model_path)
34
  model = AutoModelForCausalLM.from_pretrained(
35
  model_path,
 
37
  torch_dtype='auto'
38
  ).eval()
39
 
40
+ # Prepare your hotel review or any Italian text
41
+ prompt = '''
42
+ Analyze 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]
43
+ '''
44
+
45
+ # Tokenize and generate the response
46
+ encoding = tokenizer(prompt, return_tensors='pt', padding=True, truncation=True, max_length=500, add_special_tokens=True)
47
+ input_ids = encoding['input_ids']
48
+ attention_mask = encoding['attention_mask']
49
 
50
+ output_ids = model.generate(
51
+ input_ids.to('cuda'),
52
+ attention_mask=attention_mask.to('cuda'),
53
+ max_new_tokens=300,
54
+ pad_token_id=tokenizer.eos_token_id
55
+ )
56
 
57
+ response = tokenizer.decode(output_ids[0], skip_special_tokens=True)
58
  print(response)
59
+ ```
60
+
61
+ ## Application Scenarios
62
+
63
+ This model is invaluable for:
64
+ - Businesses analyzing customer reviews in Italian.
65
+ - Social media monitoring for sentiment analysis.
66
+ - Researchers studying public opinion on various topics through Italian text.
67
+
68
+ ## Training and Technology
69
+
70
+ `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.
71
+
72
+ ## License
73
+
74
+ This model is available under an "other" license, suitable for both commercial and non-commercial use, though users are encouraged to review the license details for full compliance with their intended applications.