Initial upload of ASAG XLNet regression model
Browse files- README.md +132 -0
- config.json +50 -0
- model.safetensors +3 -0
- special_tokens_map.json +19 -0
- spiece.model +3 -0
- tokenizer_config.json +95 -0
- training_args.bin +3 -0
README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: mit
|
| 4 |
+
library_name: transformers
|
| 5 |
+
tags:
|
| 6 |
+
- xlnet
|
| 7 |
+
- automatic-short-answer-grading
|
| 8 |
+
- regression
|
| 9 |
+
- education
|
| 10 |
+
- short-answer
|
| 11 |
+
- assessment
|
| 12 |
+
- grading
|
| 13 |
+
- transformers
|
| 14 |
+
pipeline_tag: text-classification
|
| 15 |
+
datasets:
|
| 16 |
+
- Meyerger/ASAG2024
|
| 17 |
+
metrics:
|
| 18 |
+
- mse
|
| 19 |
+
- rmse
|
| 20 |
+
- mae
|
| 21 |
+
- pearson correlation
|
| 22 |
+
model-index:
|
| 23 |
+
- name: XLENT_ASAG
|
| 24 |
+
results:
|
| 25 |
+
- task:
|
| 26 |
+
type: regression
|
| 27 |
+
name: automatic short answer grading
|
| 28 |
+
metrics:
|
| 29 |
+
- type: mse
|
| 30 |
+
value: 0.035
|
| 31 |
+
- type: rmse
|
| 32 |
+
value: 0.187
|
| 33 |
+
- type: mae
|
| 34 |
+
value: 0.142
|
| 35 |
+
- type: pearson correlation
|
| 36 |
+
value: 0.912
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
# ASAG XLNet Regression Model
|
| 40 |
+
|
| 41 |
+
This model evaluates student answers by comparing them to reference answers and predicting a grade (regression).
|
| 42 |
+
|
| 43 |
+
## Model Details
|
| 44 |
+
|
| 45 |
+
- **Model Type:** XLNet for Regression
|
| 46 |
+
- **Task:** Automatic Short Answer Grading (ASAG)
|
| 47 |
+
- **Framework:** PyTorch/Transformers
|
| 48 |
+
- **Base Model:** xlnet-base-cased
|
| 49 |
+
- **Library:** Transformers
|
| 50 |
+
|
| 51 |
+
## Usage
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
from transformers import XLNetTokenizer, XLNetForSequenceClassification
|
| 55 |
+
import torch
|
| 56 |
+
|
| 57 |
+
# Load model and tokenizer
|
| 58 |
+
tokenizer = XLNetTokenizer.from_pretrained("kenzykhaled/XLENT_ASAG")
|
| 59 |
+
model = XLNetForSequenceClassification.from_pretrained("kenzykhaled/XLENT_ASAG")
|
| 60 |
+
|
| 61 |
+
# Prepare inputs
|
| 62 |
+
student_answer = "It is vision."
|
| 63 |
+
reference_answer = "The stimulus is seeing or hearing the cup fall."
|
| 64 |
+
|
| 65 |
+
inputs = tokenizer(
|
| 66 |
+
text=student_answer,
|
| 67 |
+
text_pair=reference_answer,
|
| 68 |
+
return_tensors="pt",
|
| 69 |
+
padding=True,
|
| 70 |
+
truncation=True
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
# Get prediction
|
| 74 |
+
with torch.no_grad():
|
| 75 |
+
outputs = model(**inputs)
|
| 76 |
+
|
| 77 |
+
# Get predicted grade (normalized between 0-1)
|
| 78 |
+
predicted_grade = outputs.logits.item()
|
| 79 |
+
predicted_grade = max(0, min(1, predicted_grade))
|
| 80 |
+
print(f"Predicted grade: {predicted_grade:.4f}")
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
## Inference API Usage
|
| 84 |
+
|
| 85 |
+
This model can be used directly with the Hugging Face Inference API:
|
| 86 |
+
|
| 87 |
+
```python
|
| 88 |
+
import requests
|
| 89 |
+
|
| 90 |
+
API_URL = "https://api-inference.huggingface.co/models/kenzykhaled/XLENT_ASAG"
|
| 91 |
+
headers = {"Authorization": "Bearer YOUR_HUGGING_FACE_TOKEN"}
|
| 92 |
+
|
| 93 |
+
def query(payload):
|
| 94 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 95 |
+
return response.json()
|
| 96 |
+
|
| 97 |
+
data = {
|
| 98 |
+
"inputs": {
|
| 99 |
+
"source_sentence": "It is vision.",
|
| 100 |
+
"sentences": ["The stimulus is seeing or hearing the cup fall."]
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
result = query(data)
|
| 105 |
+
print(result)
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
## Training Data
|
| 109 |
+
|
| 110 |
+
This model was trained on the Meyerger/ASAG2024 dataset.
|
| 111 |
+
|
| 112 |
+
## Use Cases
|
| 113 |
+
|
| 114 |
+
- Automated grading of student short-answer responses
|
| 115 |
+
- Educational technology platforms
|
| 116 |
+
- Learning management systems
|
| 117 |
+
- Assessment tools
|
| 118 |
+
- Teacher assistance for grading
|
| 119 |
+
|
| 120 |
+
## Limitations
|
| 121 |
+
|
| 122 |
+
- The model is trained on specific educational domains and may not generalize well to all subjects
|
| 123 |
+
- Performance depends on the similarity of input data to the training data
|
| 124 |
+
- Should be used as an assistive tool for grading rather than a complete replacement for human evaluation
|
| 125 |
+
|
| 126 |
+
## Ethical Considerations
|
| 127 |
+
|
| 128 |
+
When using this model for automated grading:
|
| 129 |
+
- Be transparent with students about the use of AI for grading
|
| 130 |
+
- Consider potential biases in evaluation
|
| 131 |
+
- Provide human review of edge cases
|
| 132 |
+
- Allow students to appeal automated grades
|
config.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "xlnet-base-cased",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"XLNetForSequenceClassification"
|
| 5 |
+
],
|
| 6 |
+
"attn_type": "bi",
|
| 7 |
+
"bi_data": false,
|
| 8 |
+
"bos_token_id": 1,
|
| 9 |
+
"clamp_len": -1,
|
| 10 |
+
"d_head": 64,
|
| 11 |
+
"d_inner": 3072,
|
| 12 |
+
"d_model": 768,
|
| 13 |
+
"dropout": 0.1,
|
| 14 |
+
"end_n_top": 5,
|
| 15 |
+
"eos_token_id": 2,
|
| 16 |
+
"ff_activation": "gelu",
|
| 17 |
+
"id2label": {
|
| 18 |
+
"0": "LABEL_0"
|
| 19 |
+
},
|
| 20 |
+
"initializer_range": 0.02,
|
| 21 |
+
"label2id": {
|
| 22 |
+
"LABEL_0": 0
|
| 23 |
+
},
|
| 24 |
+
"layer_norm_eps": 1e-12,
|
| 25 |
+
"mem_len": null,
|
| 26 |
+
"model_type": "xlnet",
|
| 27 |
+
"n_head": 12,
|
| 28 |
+
"n_layer": 12,
|
| 29 |
+
"pad_token_id": 5,
|
| 30 |
+
"problem_type": "regression",
|
| 31 |
+
"reuse_len": null,
|
| 32 |
+
"same_length": false,
|
| 33 |
+
"start_n_top": 5,
|
| 34 |
+
"summary_activation": "tanh",
|
| 35 |
+
"summary_last_dropout": 0.1,
|
| 36 |
+
"summary_type": "last",
|
| 37 |
+
"summary_use_proj": true,
|
| 38 |
+
"task_specific_params": {
|
| 39 |
+
"text-generation": {
|
| 40 |
+
"do_sample": true,
|
| 41 |
+
"max_length": 250
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"torch_dtype": "float32",
|
| 45 |
+
"transformers_version": "4.48.3",
|
| 46 |
+
"untie_r": true,
|
| 47 |
+
"use_mems_eval": true,
|
| 48 |
+
"use_mems_train": false,
|
| 49 |
+
"vocab_size": 32000
|
| 50 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:da7fd04b521819628b7210e5f239a8a890e72ddab1a454cadd3298c1edb6044b
|
| 3 |
+
size 469261516
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<eop>",
|
| 4 |
+
"<eod>"
|
| 5 |
+
],
|
| 6 |
+
"bos_token": "<s>",
|
| 7 |
+
"cls_token": "<cls>",
|
| 8 |
+
"eos_token": "</s>",
|
| 9 |
+
"mask_token": {
|
| 10 |
+
"content": "<mask>",
|
| 11 |
+
"lstrip": true,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": "<pad>",
|
| 17 |
+
"sep_token": "<sep>",
|
| 18 |
+
"unk_token": "<unk>"
|
| 19 |
+
}
|
spiece.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1f8c1c0bc2854d1af911a8550288c1258af5ba50277f3a5c829b98eb86fc5646
|
| 3 |
+
size 798011
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "<unk>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<s>",
|
| 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": "<cls>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"4": {
|
| 36 |
+
"content": "<sep>",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
},
|
| 43 |
+
"5": {
|
| 44 |
+
"content": "<pad>",
|
| 45 |
+
"lstrip": false,
|
| 46 |
+
"normalized": false,
|
| 47 |
+
"rstrip": false,
|
| 48 |
+
"single_word": false,
|
| 49 |
+
"special": true
|
| 50 |
+
},
|
| 51 |
+
"6": {
|
| 52 |
+
"content": "<mask>",
|
| 53 |
+
"lstrip": true,
|
| 54 |
+
"normalized": false,
|
| 55 |
+
"rstrip": false,
|
| 56 |
+
"single_word": false,
|
| 57 |
+
"special": true
|
| 58 |
+
},
|
| 59 |
+
"7": {
|
| 60 |
+
"content": "<eod>",
|
| 61 |
+
"lstrip": false,
|
| 62 |
+
"normalized": false,
|
| 63 |
+
"rstrip": false,
|
| 64 |
+
"single_word": false,
|
| 65 |
+
"special": true
|
| 66 |
+
},
|
| 67 |
+
"8": {
|
| 68 |
+
"content": "<eop>",
|
| 69 |
+
"lstrip": false,
|
| 70 |
+
"normalized": false,
|
| 71 |
+
"rstrip": false,
|
| 72 |
+
"single_word": false,
|
| 73 |
+
"special": true
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
"additional_special_tokens": [
|
| 77 |
+
"<eop>",
|
| 78 |
+
"<eod>"
|
| 79 |
+
],
|
| 80 |
+
"bos_token": "<s>",
|
| 81 |
+
"clean_up_tokenization_spaces": false,
|
| 82 |
+
"cls_token": "<cls>",
|
| 83 |
+
"do_lower_case": false,
|
| 84 |
+
"eos_token": "</s>",
|
| 85 |
+
"extra_special_tokens": {},
|
| 86 |
+
"keep_accents": false,
|
| 87 |
+
"mask_token": "<mask>",
|
| 88 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 89 |
+
"pad_token": "<pad>",
|
| 90 |
+
"remove_space": true,
|
| 91 |
+
"sep_token": "<sep>",
|
| 92 |
+
"sp_model_kwargs": {},
|
| 93 |
+
"tokenizer_class": "XLNetTokenizer",
|
| 94 |
+
"unk_token": "<unk>"
|
| 95 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fecb7fd8880f0171d83b7bceea56341321593b0cea8e8df4b89edb1be3c3e327
|
| 3 |
+
size 5304
|