advexon commited on
Commit
a1a4186
·
verified ·
1 Parent(s): ad5b779

Initial multilingual model deployment

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - text-classification
5
+ - sentiment-analysis
6
+ - transformers
7
+ - pytorch
8
+ - multilingual
9
+ license: mit
10
+ ---
11
+
12
+ # advexon/multilingual-sentiment-classifier
13
+
14
+ Multilingual text classification model trained on XLM-RoBERTa base for sentiment analysis across English, Russian, Tajik and other languages
15
+
16
+ ## Model Description
17
+
18
+ This is a multilingual text classification model based on XLM-RoBERTa. It has been trained for sentiment analysis across multiple languages and can classify text into positive, negative, and neutral categories.
19
+
20
+ ## Model Details
21
+
22
+ - **Base Model**: XLM-RoBERTa Base
23
+ - **Number of Labels**: 3 (Positive, Negative, Neutral)
24
+ - **Languages**: Multilingual (English, Russian, Tajik, and others)
25
+ - **Max Sequence Length**: 512 tokens
26
+
27
+ ## Performance
28
+
29
+ Based on training metrics:
30
+ - **Training Accuracy**: 58.33%
31
+ - **Validation Accuracy**: 100%
32
+ - **Training Loss**: 0.94
33
+ - **Validation Loss**: 0.79
34
+
35
+ ## Usage
36
+
37
+ ### Using the Model
38
+
39
+ ```python
40
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
41
+ import torch
42
+
43
+ # Load the model and tokenizer
44
+ tokenizer = AutoTokenizer.from_pretrained("advexon/multilingual-sentiment-classifier")
45
+ model = AutoModelForSequenceClassification.from_pretrained("advexon/multilingual-sentiment-classifier")
46
+
47
+ # Example usage
48
+ text = "This product is amazing!"
49
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
50
+ outputs = model(**inputs)
51
+ predictions = torch.softmax(outputs.logits, dim=-1)
52
+ predicted_class = torch.argmax(predictions, dim=1).item()
53
+
54
+ # Class mapping: 0=Negative, 1=Neutral, 2=Positive
55
+ sentiment_labels = ["Negative", "Neutral", "Positive"]
56
+ predicted_sentiment = sentiment_labels[predicted_class]
57
+ print(f"Predicted sentiment: {predicted_sentiment}")
58
+ ```
59
+
60
+ ### Example Predictions
61
+
62
+ - "I absolutely love this product!" → Positive
63
+ - "This is terrible quality." → Negative
64
+ - "It's okay, nothing special." → Neutral
65
+ - "Отличный сервис!" → Positive (Russian)
66
+ - "Хунуки хуб нест" → Negative (Tajik)
67
+
68
+ ## Training
69
+
70
+ This model was trained using:
71
+ - **Base Model**: XLM-RoBERTa Base
72
+ - **Optimizer**: AdamW
73
+ - **Learning Rate**: 2e-5
74
+ - **Batch Size**: 16
75
+ - **Training Epochs**: 2
76
+ - **Languages**: English, Russian, Tajik
77
+
78
+ ## Limitations
79
+
80
+ - The model's performance may vary across different languages
81
+ - It is recommended to fine-tune on domain-specific data for optimal performance
82
+ - Maximum input length is 512 tokens
83
+ - Performance may be lower on languages not well-represented in the training data
84
+
85
+ ## Citation
86
+
87
+ If you use this model in your research, please cite:
88
+
89
+ ```bibtex
90
+ @misc{multilingual-text-classifier,
91
+ title={Multilingual Text Classification Model},
92
+ author={Your Name},
93
+ year={2024},
94
+ publisher={Hugging Face},
95
+ journal={Hugging Face Hub},
96
+ howpublished={\url{https://huggingface.co/advexon/multilingual-sentiment-classifier}},
97
+ }
98
+ ```
model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6cd22b17644ac6c33208e21799831c9636fc015433179e5b8b3cd11b5e55ba66
3
+ size 1113428295
model_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "model_name": "xlm-roberta-base",
3
+ "num_labels": 3,
4
+ "dropout_rate": 0.2,
5
+ "hidden_size": 768
6
+ }
processor_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_name": "xlm-roberta-base",
3
+ "max_length": 512,
4
+ "truncation": true,
5
+ "padding": true,
6
+ "label_mapping": {}
7
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "cls_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "mask_token": {
6
+ "content": "<mask>",
7
+ "lstrip": true,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "unk_token": "<unk>"
15
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:883b037111086fd4dfebbbc9b7cee11e1517b5e0c0514879478661440f137085
3
+ size 17082987
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "250001": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": false,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "extra_special_tokens": {},
49
+ "mask_token": "<mask>",
50
+ "model_max_length": 512,
51
+ "pad_token": "<pad>",
52
+ "sep_token": "</s>",
53
+ "tokenizer_class": "XLMRobertaTokenizer",
54
+ "unk_token": "<unk>"
55
+ }