kevintu commited on
Commit
5604aae
·
verified ·
1 Parent(s): 0630a2c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +49 -2
README.md CHANGED
@@ -13,7 +13,7 @@ The model's performance on the test dataset, which includes around 980 English e
13
  Upon inputting an essay, the model outputs six scores corresponding to cohesion, syntax, vocabulary, phraseology, grammar, and conventions. Each score ranges from 1 to 5, with higher scores indicating greater proficiency within the essay. These dimensions collectively assess the quality of the input essay from multiple perspectives. The model serves as a valuable tool for EFL teachers and researchers, and it is also beneficial for English L2 learners and parents for self-evaluating their composition skills.
14
 
15
  To test the model, run the following code or paste your essay into the API interface:
16
-
17
 
18
  ```
19
  #import packages
@@ -59,7 +59,7 @@ trait_names = ["cohesion", "syntax", "vocabulary", "phraseology", "grammar", "c
59
  for trait, score in zip(trait_names, predicted_scores):
60
  print(f"{trait}: {score:.4f}")
61
 
62
- ##"output":
63
  #cohesion: 3.5399
64
  #syntax: 3.6380
65
  #vocabulary: 3.9250
@@ -67,4 +67,51 @@ for trait, score in zip(trait_names, predicted_scores):
67
  #grammar: 3.9194
68
  #conventions: 3.6819
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  ```
 
13
  Upon inputting an essay, the model outputs six scores corresponding to cohesion, syntax, vocabulary, phraseology, grammar, and conventions. Each score ranges from 1 to 5, with higher scores indicating greater proficiency within the essay. These dimensions collectively assess the quality of the input essay from multiple perspectives. The model serves as a valuable tool for EFL teachers and researchers, and it is also beneficial for English L2 learners and parents for self-evaluating their composition skills.
14
 
15
  To test the model, run the following code or paste your essay into the API interface:
16
+ Please use the following if you want to get the ouput values ranging from 1 to 5.
17
 
18
  ```
19
  #import packages
 
59
  for trait, score in zip(trait_names, predicted_scores):
60
  print(f"{trait}: {score:.4f}")
61
 
62
+ ##"output" (values raning from 1 to 5):
63
  #cohesion: 3.5399
64
  #syntax: 3.6380
65
  #vocabulary: 3.9250
 
67
  #grammar: 3.9194
68
  #conventions: 3.6819
69
 
70
+ ```
71
+
72
+ However, implment the following code if you have the output values between 1 to 10.
73
+
74
+ ```
75
+ # Import packages
76
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
77
+ import torch
78
+
79
+ # Load model and tokenizer
80
+ model = AutoModelForSequenceClassification.from_pretrained("Kevintu/Engessay_grading_ML")
81
+ tokenizer = AutoTokenizer.from_pretrained("Kevintu/Engessay_grading_ML")
82
+
83
+ # Example new text input
84
+ new_text = "The English Language Learner Insight, Proficiency and Skills Evaluation (ELLIPSE) Corpus is a freely available corpus of ~6,500 ELL writing samples that have been scored for overall holistic language proficiency as well as analytic proficiency scores related to cohesion, syntax, vocabulary, phraseology, grammar, and conventions. In addition, the ELLIPSE corpus provides individual and demographic information for the ELL writers in the corpus including economic status, gender, grade level (8-12), and race/ethnicity. The corpus provides language proficiency scores for individual writers and was developed to advance research in corpus and NLP approaches to assess overall and more fine-grained features of proficiency."
85
+
86
+ # Encode the text
87
+ encoded_input = tokenizer(new_text, return_tensors='pt', padding=True, truncation=True, max_length=64)
88
+
89
+ # Evaluate model
90
+ model.eval()
91
+ with torch.no_grad():
92
+ outputs = model(**encoded_input)
93
+
94
+ # Get predictions
95
+ predictions = outputs.logits.squeeze()
96
+
97
+ # Convert predictions if necessary
98
+ predicted_scores = predictions.numpy() # Convert to numpy array
99
+ trait_names = ["cohesion", "syntax", "vocabulary", "phraseology", "grammar", "conventions"]
100
+
101
+ # Scale predictions from 1 to 10
102
+ scaled_scores = 2.25 * predicted_scores - 1.25
103
+
104
+ # Print the scaled personality traits scores
105
+ for trait, score in zip(trait_names, scaled_scores):
106
+ print(f"{trait}: {score:.4f}")
107
+
108
+ ##"ouput" (values between 1-10)
109
+
110
+ #cohesion: 6.7147
111
+ #syntax: 6.9354
112
+ #vocabulary: 7.5814
113
+ #phraseology: 7.3856
114
+ #grammar: 7.5687
115
+ #conventions: 7.0344
116
+
117
  ```