Vishnu2517 commited on
Commit
9220b75
·
verified ·
1 Parent(s): 0d1372a

Upload folder using huggingface_hub

Browse files
Files changed (8) hide show
  1. README.md +84 -0
  2. config.json +26 -0
  3. demo.py +56 -0
  4. model.safetensors +3 -0
  5. special_tokens_map.json +7 -0
  6. tokenizer.json +0 -0
  7. tokenizer_config.json +56 -0
  8. vocab.txt +0 -0
README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - text-classification
6
+ - edtech
7
+ - feedback-validation
8
+ - bert
9
+ - pytorch
10
+ license: mit
11
+ datasets:
12
+ - custom-edtech-feedback
13
+ metrics:
14
+ - accuracy
15
+ - precision
16
+ - recall
17
+ - f1
18
+ ---
19
+
20
+ # EdTech Feedback Validation Model
21
+
22
+ ## Model Description
23
+
24
+ This model is designed to validate user feedback in EdTech applications by determining whether a given feedback text aligns with a selected reason. It uses a BERT-based architecture for text pair classification.
25
+
26
+ ## Intended Uses & Limitations
27
+
28
+ ### Primary Use Case
29
+ - Validating user feedback in educational technology applications
30
+ - Ensuring feedback text aligns with predefined reason categories
31
+ - Improving user experience by providing accurate feedback categorization
32
+
33
+ ### Limitations
34
+ - Trained on English text only
35
+ - Requires both feedback text and reason text as input
36
+ - Binary classification (aligned/not aligned)
37
+
38
+ ## Training and Evaluation Data
39
+
40
+ The model was trained on a custom dataset containing:
41
+ - Training samples: 2,061 feedback-reason pairs
42
+ - Evaluation samples: 9,000 feedback-reason pairs
43
+ - All training samples were positive (aligned) examples
44
+ - Evaluation set contains both positive and negative examples
45
+
46
+ ## Usage
47
+
48
+ ```python
49
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
50
+ import torch
51
+
52
+ # Load model and tokenizer
53
+ model_name = "your-username/edtech-feedback-validation"
54
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
55
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
56
+
57
+ # Example usage
58
+ text = "this is an amazing app for online classes!"
59
+ reason = "good app for conducting online classes"
60
+
61
+ # Tokenize inputs
62
+ inputs = tokenizer(text, reason, return_tensors="pt", padding=True, truncation=True)
63
+
64
+ # Get prediction
65
+ with torch.no_grad():
66
+ outputs = model(**inputs)
67
+ probabilities = torch.softmax(outputs.logits, dim=1)
68
+ prediction = torch.argmax(probabilities, dim=1).item()
69
+ confidence = probabilities[0][prediction].item()
70
+
71
+ print(f"Prediction: {prediction} (Aligned: {prediction == 1})")
72
+ print(f"Confidence: {confidence:.3f}")
73
+ ```
74
+
75
+ ## Model Architecture
76
+
77
+ - Base Model: BERT (bert-base-uncased)
78
+ - Task: Text Pair Classification
79
+ - Output: Binary classification (0: Not Aligned, 1: Aligned)
80
+ - Training Framework: PyTorch
81
+
82
+ ## License
83
+
84
+ This model is released under the MIT License.
config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertForSequenceClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "dtype": "float32",
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "layer_norm_eps": 1e-12,
15
+ "max_position_embeddings": 512,
16
+ "model_type": "bert",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 12,
19
+ "pad_token_id": 0,
20
+ "position_embedding_type": "absolute",
21
+ "problem_type": "single_label_classification",
22
+ "transformers_version": "4.56.0",
23
+ "type_vocab_size": 2,
24
+ "use_cache": true,
25
+ "vocab_size": 30522
26
+ }
demo.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Demo script for EdTech Feedback Validation Model
4
+ """
5
+
6
+ import torch
7
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
8
+
9
+ def load_model(model_name):
10
+ """Load the model and tokenizer"""
11
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
12
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
13
+ return tokenizer, model
14
+
15
+ def predict_alignment(text, reason, tokenizer, model):
16
+ """Predict whether text aligns with reason"""
17
+ # Tokenize inputs
18
+ inputs = tokenizer(
19
+ text,
20
+ reason,
21
+ return_tensors="pt",
22
+ padding=True,
23
+ truncation=True,
24
+ max_length=512
25
+ )
26
+
27
+ # Get prediction
28
+ with torch.no_grad():
29
+ outputs = model(**inputs)
30
+ probabilities = torch.softmax(outputs.logits, dim=1)
31
+ prediction = torch.argmax(probabilities, dim=1).item()
32
+ confidence = probabilities[0][prediction].item()
33
+
34
+ return prediction, confidence
35
+
36
+ if __name__ == "__main__":
37
+ # Example usage
38
+ model_name = "your-username/edtech-feedback-validation"
39
+
40
+ # Load model
41
+ tokenizer, model = load_model(model_name)
42
+
43
+ # Test examples
44
+ test_cases = [
45
+ ("this is an amazing app for online classes!", "good app for conducting online classes"),
46
+ ("i cannot login to zoom", "help"),
47
+ ("very practical and easy to use", "app is user-friendly")
48
+ ]
49
+
50
+ for text, reason in test_cases:
51
+ prediction, confidence = predict_alignment(text, reason, tokenizer, model)
52
+ result = "ALIGNED" if prediction == 1 else "NOT ALIGNED"
53
+ print(f"Text: {text}")
54
+ print(f"Reason: {reason}")
55
+ print(f"Result: {result} (Confidence: {confidence:.3f})")
56
+ print("-" * 50)
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ddf5c176d5141cee3262e645655e2ee5a7653e71a8f522b80e3c6703233b048f
3
+ size 437958648
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": false,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": true,
47
+ "extra_special_tokens": {},
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 512,
50
+ "pad_token": "[PAD]",
51
+ "sep_token": "[SEP]",
52
+ "strip_accents": null,
53
+ "tokenize_chinese_chars": true,
54
+ "tokenizer_class": "BertTokenizer",
55
+ "unk_token": "[UNK]"
56
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff