mohit4519 commited on
Commit
6c7003f
·
verified ·
1 Parent(s): 6159cad

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +86 -0
  2. config.json +35 -0
  3. model.onnx +3 -0
  4. model.safetensors +3 -0
README.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: ne
3
+ license: apache-2.0
4
+ tags:
5
+ - sentiment-analysis
6
+ - nepali
7
+ - onnx
8
+ - bert
9
+ - text-classification
10
+ datasets:
11
+ - custom-nepali-sentiment
12
+ metrics:
13
+ - f1
14
+ - accuracy
15
+ model-index:
16
+ - name: mohit4519/nepali-sentiment
17
+ results:
18
+ - task:
19
+ type: text-classification
20
+ name: Sentiment Analysis
21
+ dataset:
22
+ name: Nepali Sentiment Dataset
23
+ type: custom
24
+ metrics:
25
+ - type: f1
26
+ value: 0.XX # Replace with your actual score
27
+ name: Macro F1
28
+ ---
29
+
30
+ # Nepali Sentiment Analysis (ONNX)
31
+
32
+ This model is a fine-tuned BERT model for Nepali sentiment analysis, exported to ONNX format for optimized inference.
33
+
34
+ ## Model Details
35
+
36
+ - **Base Model**: Shushant/nepaliBERT
37
+ - **Task**: Sentiment Classification (3-class)
38
+ - **Labels**:
39
+ - 0: Negative
40
+ - 1: Positive
41
+ - 2: Neutral
42
+ - **Format**: ONNX (optimized for fast inference)
43
+
44
+ ## Usage
45
+
46
+ ### Installation
47
+
48
+ ```bash
49
+ pip install transformers optimum[onnxruntime]
50
+ ```
51
+
52
+ ### Inference
53
+
54
+ ```python
55
+ from transformers import AutoTokenizer
56
+ from optimum.onnxruntime import ORTModelForSequenceClassification
57
+ import torch
58
+
59
+ # Load model and tokenizer
60
+ model = ORTModelForSequenceClassification.from_pretrained("mohit4519/nepali-sentiment")
61
+ tokenizer = AutoTokenizer.from_pretrained("Shushant/nepaliBERT")
62
+
63
+ # Predict sentiment
64
+ text = "यो धेरै राम्रो छ"
65
+ inputs = tokenizer(text, return_tensors="pt")
66
+ outputs = model(**inputs)
67
+ prediction = torch.argmax(outputs.logits, dim=-1).item()
68
+
69
+ sentiment_map = {0: 'Negative', 1: 'Positive', 2: 'Neutral'}
70
+ print(f"Sentiment: {sentiment_map[prediction]}")
71
+ ```
72
+
73
+ ## Performance
74
+
75
+ - **Macro F1 Score**: 0.XX (Replace with your score)
76
+ - **Accuracy**: 0.XX (Replace with your score)
77
+
78
+ ## Training Data
79
+
80
+ Trained on Nepali sentiment dataset containing social media text, reviews, and comments.
81
+
82
+ ## Limitations
83
+
84
+ - Best performance on Nepali text
85
+ - May have reduced accuracy on code-mixed or transliterated text
86
+ - Performance varies across different domains
config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertForSequenceClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "hidden_act": "gelu",
8
+ "hidden_dropout_prob": 0.1,
9
+ "hidden_size": 768,
10
+ "id2label": {
11
+ "0": "LABEL_0",
12
+ "1": "LABEL_1",
13
+ "2": "LABEL_2"
14
+ },
15
+ "initializer_range": 0.02,
16
+ "intermediate_size": 3072,
17
+ "label2id": {
18
+ "LABEL_0": 0,
19
+ "LABEL_1": 1,
20
+ "LABEL_2": 2
21
+ },
22
+ "layer_norm_eps": 1e-12,
23
+ "max_position_embeddings": 512,
24
+ "model_type": "bert",
25
+ "num_attention_heads": 12,
26
+ "num_hidden_layers": 12,
27
+ "pad_token_id": 0,
28
+ "position_embedding_type": "absolute",
29
+ "problem_type": "single_label_classification",
30
+ "torch_dtype": "float32",
31
+ "transformers_version": "4.55.4",
32
+ "type_vocab_size": 2,
33
+ "use_cache": true,
34
+ "vocab_size": 30522
35
+ }
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e051833d807404b5eca46bb60b849488d26eaf8cc74def91c52bf0628492e82
3
+ size 438148593
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bec6173904155887f49a7b3d3681f0cb8e92c0f4527c88ee70a6e51666df130f
3
+ size 437961724