long2811 commited on
Commit
b232818
·
verified ·
1 Parent(s): 2e6bf26

Update model/mistral_7b_ielts_evaluator.py

Browse files
model/mistral_7b_ielts_evaluator.py CHANGED
@@ -2,9 +2,10 @@ from typing import *
2
  import torch
3
  from transformers import pipeline
4
  import spaces
5
- from .common import Grader, 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:
@@ -48,7 +49,6 @@ class Mistral_7b_IELTS_Evaluator(Grader):
48
  def info(self) -> str:
49
  return "Safetensors version of [chillies/mistral-7b-ielts-evaluator-q4](https://huggingface.co/chillies/mistral-7b-ielts-evaluator-q4)"
50
 
51
- @spaces.GPU(duration=120)
52
  @torch.no_grad()
53
  def grade(self, question: str, answer: str) -> Tuple[float, str]:
54
  text = f"""{system}
 
2
  import torch
3
  from transformers import pipeline
4
  import spaces
5
+ from .common import Grader
6
 
7
  model_name = "JacobLinCool/mistral-7b-ielts-evaluator-safetensors"
8
+ device = -1 # Chỉ sử dụng CPU
9
  pipe = pipeline("text-generation", model_name, device=device)
10
 
11
  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:
 
49
  def info(self) -> str:
50
  return "Safetensors version of [chillies/mistral-7b-ielts-evaluator-q4](https://huggingface.co/chillies/mistral-7b-ielts-evaluator-q4)"
51
 
 
52
  @torch.no_grad()
53
  def grade(self, question: str, answer: str) -> Tuple[float, str]:
54
  text = f"""{system}