dvilasuero HF Staff commited on
Commit
f01f1ea
·
verified ·
1 Parent(s): c85d4e2

Update tasks/text.py

Browse files
Files changed (1) hide show
  1. tasks/text.py +10 -3
tasks/text.py CHANGED
@@ -4,6 +4,8 @@ from datasets import load_dataset
4
  from sklearn.metrics import accuracy_score
5
  import random
6
 
 
 
7
  from .utils.evaluation import TextEvaluationRequest
8
  from .utils.emissions import tracker, clean_emissions_data, get_space_info
9
 
@@ -56,9 +58,14 @@ async def evaluate_text(request: TextEvaluationRequest):
56
  # Update the code below to replace the random baseline by your model inference within the inference pass where the energy consumption and emissions are tracked.
57
  #--------------------------------------------------------------------------------------------
58
 
59
- # Make random predictions (placeholder for actual model inference)
60
- true_labels = test_dataset["label"]
61
- predictions = [random.randint(0, 7) for _ in range(len(true_labels))]
 
 
 
 
 
62
 
63
  #--------------------------------------------------------------------------------------------
64
  # YOUR MODEL INFERENCE STOPS HERE
 
4
  from sklearn.metrics import accuracy_score
5
  import random
6
 
7
+ from transformers import pipeline
8
+
9
  from .utils.evaluation import TextEvaluationRequest
10
  from .utils.emissions import tracker, clean_emissions_data, get_space_info
11
 
 
58
  # Update the code below to replace the random baseline by your model inference within the inference pass where the energy consumption and emissions are tracked.
59
  #--------------------------------------------------------------------------------------------
60
 
61
+
62
+
63
+ # load model from huggingface.co/models using our repository id
64
+ classifier = pipeline(
65
+ task="text-classification",
66
+ model="dvilasuero/ModernBERT-frugal",
67
+ device=0,
68
+ )
69
 
70
  #--------------------------------------------------------------------------------------------
71
  # YOUR MODEL INFERENCE STOPS HERE