advexon commited on
Commit
20e2301
·
verified ·
1 Parent(s): 5ae4cef

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +116 -111
README.md CHANGED
@@ -1,111 +1,116 @@
1
- ---
2
- language: en
3
- tags:
4
- - text-classification
5
- - sentiment-analysis
6
- - transformers
7
- - pytorch
8
- - multilingual
9
- - xlm-roberta
10
- license: mit
11
- ---
12
-
13
- # advexon/multilingual-sentiment-classifier
14
-
15
- Multilingual text classification model trained on XLM-RoBERTa base for sentiment analysis across English, Russian, Tajik and other languages
16
-
17
- ## Model Description
18
-
19
- This is a multilingual text classification model based on XLM-RoBERTa. It has been fine-tuned for sentiment analysis across multiple languages and can classify text into positive, negative, and neutral categories.
20
-
21
- ## Model Details
22
-
23
- - **Base Model**: XLM-RoBERTa Base
24
- - **Model Type**: XLMRobertaForSequenceClassification
25
- - **Number of Labels**: 3 (Negative, Neutral, Positive)
26
- - **Languages**: Multilingual (English, Russian, Tajik, and others)
27
- - **Max Sequence Length**: 512 tokens
28
- - **Hidden Size**: 768
29
- - **Attention Heads**: 12
30
- - **Layers**: 12
31
-
32
- ## Performance
33
-
34
- Based on training metrics:
35
- - **Training Accuracy**: 58.33%
36
- - **Validation Accuracy**: 100%
37
- - **Training Loss**: 0.94
38
- - **Validation Loss**: 0.79
39
-
40
- ## Usage
41
-
42
- ### Using the Model
43
-
44
- ```python
45
- from transformers import AutoTokenizer, AutoModelForSequenceClassification
46
- import torch
47
-
48
- # Load the model and tokenizer
49
- tokenizer = AutoTokenizer.from_pretrained("advexon/multilingual-sentiment-classifier")
50
- model = AutoModelForSequenceClassification.from_pretrained("advexon/multilingual-sentiment-classifier")
51
-
52
- # Example usage
53
- text = "This product is amazing!"
54
- inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
55
- outputs = model(**inputs)
56
- predictions = torch.softmax(outputs.logits, dim=-1)
57
- predicted_class = torch.argmax(predictions, dim=1).item()
58
-
59
- # Class mapping: 0=Negative, 1=Neutral, 2=Positive
60
- sentiment_labels = ["Negative", "Neutral", "Positive"]
61
- predicted_sentiment = sentiment_labels[predicted_class]
62
- print(f"Predicted sentiment: {predicted_sentiment}")
63
- ```
64
-
65
- ### Example Predictions
66
-
67
- - "I absolutely love this product!" → Positive
68
- - "This is terrible quality." → Negative
69
- - "It's okay, nothing special." → Neutral
70
- - "Отличный сервис!" → Positive (Russian)
71
- - "Хунуки хуб нест" → Negative (Tajik)
72
-
73
- ## Training
74
-
75
- This model was trained using:
76
- - **Base Model**: XLM-RoBERTa Base
77
- - **Optimizer**: AdamW
78
- - **Learning Rate**: 2e-5
79
- - **Batch Size**: 16
80
- - **Training Epochs**: 2
81
- - **Languages**: English, Russian, Tajik
82
-
83
- ## Model Architecture
84
-
85
- The model uses the XLM-RoBERTa architecture with:
86
- - 12 transformer layers
87
- - 768 hidden dimensions
88
- - 12 attention heads
89
- - 3 classification heads for sentiment analysis
90
-
91
- ## Limitations
92
-
93
- - The model's performance may vary across different languages
94
- - It is recommended to fine-tune on domain-specific data for optimal performance
95
- - Maximum input length is 512 tokens
96
- - Performance may be lower on languages not well-represented in the training data
97
-
98
- ## Citation
99
-
100
- If you use this model in your research, please cite:
101
-
102
- ```bibtex
103
- @misc{multilingual-text-classifier,
104
- title={Multilingual Text Classification Model},
105
- author={Advexon},
106
- year={2024},
107
- publisher={Hugging Face},
108
- journal={Hugging Face Hub},
109
- howpublished={\url{https://huggingface.co/advexon/multilingual-sentiment-classifier}},
110
- }
111
- ```
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - text-classification
5
+ - sentiment-analysis
6
+ - transformers
7
+ - pytorch
8
+ - multilingual
9
+ - xlm-roberta
10
+ - Siyovush Mirzoev
11
+ - Tajik
12
+ - Tajikistan
13
+ license: mit
14
+ ---
15
+
16
+ # advexon/multilingual-sentiment-classifier
17
+
18
+ Multilingual text classification model trained on XLM-RoBERTa base for sentiment analysis across English, Russian, Tajik and other languages
19
+
20
+ ## Model Description
21
+
22
+ This is a multilingual text classification model based on XLM-RoBERTa. It has been fine-tuned for sentiment analysis across multiple languages and can classify text into positive, negative, and neutral categories.
23
+
24
+ ## Model Details
25
+
26
+ - **Base Model**: XLM-RoBERTa Base
27
+ - **Model Type**: XLMRobertaForSequenceClassification
28
+ - **Number of Labels**: 3 (Negative, Neutral, Positive)
29
+ - **Languages**: Multilingual (English, Russian, Tajik, and others)
30
+ - **Max Sequence Length**: 512 tokens
31
+ - **Hidden Size**: 768
32
+ - **Attention Heads**: 12
33
+ - **Layers**: 12
34
+
35
+ ## Performance
36
+
37
+ Based on training metrics:
38
+ - **Training Accuracy**: 58.33%
39
+ - **Validation Accuracy**: 100%
40
+ - **Training Loss**: 0.94
41
+ - **Validation Loss**: 0.79
42
+
43
+ ## Usage
44
+
45
+ ### Using the Model
46
+
47
+ ```python
48
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
49
+ import torch
50
+
51
+ # Load the model and tokenizer
52
+ tokenizer = AutoTokenizer.from_pretrained("advexon/multilingual-sentiment-classifier")
53
+ model = AutoModelForSequenceClassification.from_pretrained("advexon/multilingual-sentiment-classifier")
54
+
55
+ # Example usage
56
+ text = "This product is amazing!"
57
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
58
+ outputs = model(**inputs)
59
+ predictions = torch.softmax(outputs.logits, dim=-1)
60
+ predicted_class = torch.argmax(predictions, dim=1).item()
61
+
62
+ # Class mapping: 0=Negative, 1=Neutral, 2=Positive
63
+ sentiment_labels = ["Negative", "Neutral", "Positive"]
64
+ predicted_sentiment = sentiment_labels[predicted_class]
65
+ print(f"Predicted sentiment: {predicted_sentiment}")
66
+ ```
67
+
68
+ ### Example Predictions
69
+
70
+ - "I absolutely love this product!" → Positive
71
+ - "This is terrible quality." → Negative
72
+ - "It's okay, nothing special." → Neutral
73
+ - "Отличный сервис!" → Positive (Russian)
74
+ - "Хунуки хуб нест" → Negative (Tajik)
75
+
76
+ ## Training
77
+
78
+ This model was trained using:
79
+ - **Base Model**: XLM-RoBERTa Base
80
+ - **Optimizer**: AdamW
81
+ - **Learning Rate**: 2e-5
82
+ - **Batch Size**: 16
83
+ - **Training Epochs**: 2
84
+ - **Languages**: English, Russian, Tajik
85
+
86
+ ## Model Architecture
87
+
88
+ The model uses the XLM-RoBERTa architecture with:
89
+ - 12 transformer layers
90
+ - 768 hidden dimensions
91
+ - 12 attention heads
92
+ - 3 classification heads for sentiment analysis
93
+
94
+ ## Limitations
95
+
96
+ - The model's performance may vary across different languages
97
+ - It is recommended to fine-tune on domain-specific data for optimal performance
98
+ - Maximum input length is 512 tokens
99
+ - Performance may be lower on languages not well-represented in the training data
100
+
101
+ ## Citation
102
+
103
+ If you use this model in your research, please cite:
104
+
105
+ ```bibtex
106
+ @misc{multilingual-text-classifier,
107
+ title={Multilingual Text Classification Model},
108
+ author={Advexon},
109
+ year={2024},
110
+ publisher={Siyovush Mirzoev},
111
+ journal={Hugging Face Hub},
112
+ howpublished={\url{https://huggingface.co/advexon/multilingual-sentiment-classifier}},
113
+ }
114
+ ```
115
+ ## Contact me
116
+ mirzoevsish@gmail.com / +992 710707777 WhatsApp