Spaces:
Running
on
Zero
Running
on
Zero
JacobLinCool
commited on
Commit
•
946fdeb
1
Parent(s):
edc139b
perf: use de-quantized mistral-7b-ielts-evaluator
Browse files- README.md +1 -1
- model/__init__.py +0 -0
- model/common.py +4 -0
- model/mistral_7b_ielts_evaluator.py +5 -7
README.md
CHANGED
@@ -11,7 +11,7 @@ license: mit
|
|
11 |
preload_from_hub:
|
12 |
- JacobLinCool/IELTS_essay_scoring_safetensors
|
13 |
- KevSun/Engessay_grading_ML
|
14 |
-
-
|
15 |
---
|
16 |
|
17 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
11 |
preload_from_hub:
|
12 |
- JacobLinCool/IELTS_essay_scoring_safetensors
|
13 |
- KevSun/Engessay_grading_ML
|
14 |
+
- JacobLinCool/mistral-7b-ielts-evaluator-safetensors
|
15 |
---
|
16 |
|
17 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
model/__init__.py
ADDED
File without changes
|
model/common.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from accelerate import Accelerator
|
2 |
+
|
3 |
+
accelerator = Accelerator()
|
4 |
+
device = accelerator.device
|
model/mistral_7b_ielts_evaluator.py
CHANGED
@@ -1,13 +1,11 @@
|
|
1 |
from typing import *
|
2 |
import torch
|
3 |
-
from transformers import
|
4 |
import spaces
|
|
|
5 |
|
6 |
-
model_name = "
|
7 |
-
|
8 |
-
model = AutoModelForCausalLM.from_pretrained(model_name, gguf_file=file_name)
|
9 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name, gguf_file=file_name)
|
10 |
-
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
11 |
|
12 |
system = """In this task, you are required to evaluate an IELTS Writing Task 2 essay. Consider the following four criteria and provide a detailed assessment for each, along with a suggested band score:
|
13 |
|
@@ -60,7 +58,7 @@ def grade_mistral_7b_ielts_evaluator(question: str, answer: str) -> Tuple[float,
|
|
60 |
## Evaluation:
|
61 |
"""
|
62 |
|
63 |
-
outputs = pipe(text)
|
64 |
overall_score = float(0.0)
|
65 |
|
66 |
return overall_score, outputs
|
|
|
1 |
from typing import *
|
2 |
import torch
|
3 |
+
from transformers import pipeline
|
4 |
import spaces
|
5 |
+
from .common import device
|
6 |
|
7 |
+
model_name = "JacobLinCool/mistral-7b-ielts-evaluator-safetensors"
|
8 |
+
pipe = pipeline("text-generation", model_name, device=device)
|
|
|
|
|
|
|
9 |
|
10 |
system = """In this task, you are required to evaluate an IELTS Writing Task 2 essay. Consider the following four criteria and provide a detailed assessment for each, along with a suggested band score:
|
11 |
|
|
|
58 |
## Evaluation:
|
59 |
"""
|
60 |
|
61 |
+
outputs = pipe(text, max_length=1024)
|
62 |
overall_score = float(0.0)
|
63 |
|
64 |
return overall_score, outputs
|