Commit
·
d11f2f9
1
Parent(s):
cc921f8
Clean up
Browse files- tasks/text.py +13 -8
tasks/text.py
CHANGED
@@ -11,7 +11,17 @@ router = APIRouter()
|
|
11 |
|
12 |
DESCRIPTION = "Most common class baseline"
|
13 |
ROUTE = "/text"
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
@router.post(ROUTE, tags=["Text Task"],
|
16 |
description=DESCRIPTION)
|
17 |
async def evaluate_text(request: TextEvaluationRequest):
|
@@ -55,15 +65,10 @@ async def evaluate_text(request: TextEvaluationRequest):
|
|
55 |
# YOUR MODEL INFERENCE CODE HERE
|
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 |
-
# My favorate baseline is the most common class.
|
64 |
true_labels = test_dataset["label"]
|
65 |
-
predictions =
|
66 |
-
|
67 |
#--------------------------------------------------------------------------------------------
|
68 |
# YOUR MODEL INFERENCE STOPS HERE
|
69 |
#--------------------------------------------------------------------------------------------
|
|
|
11 |
|
12 |
DESCRIPTION = "Most common class baseline"
|
13 |
ROUTE = "/text"
|
14 |
+
|
15 |
+
def baseline_model(dataset_length):
|
16 |
+
# Make random predictions (placeholder for actual model inference)
|
17 |
+
#predictions = [random.randint(0, 7) for _ in range(dataset_length)]
|
18 |
+
|
19 |
+
# My favorate baseline is the most common class.
|
20 |
+
predictions = [0] * dataset_length
|
21 |
+
|
22 |
+
return predictions
|
23 |
+
|
24 |
+
|
25 |
@router.post(ROUTE, tags=["Text Task"],
|
26 |
description=DESCRIPTION)
|
27 |
async def evaluate_text(request: TextEvaluationRequest):
|
|
|
65 |
# YOUR MODEL INFERENCE CODE HERE
|
66 |
# 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.
|
67 |
#--------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
68 |
|
|
|
69 |
true_labels = test_dataset["label"]
|
70 |
+
predictions = baseline_model(len(true_labels))
|
71 |
+
|
72 |
#--------------------------------------------------------------------------------------------
|
73 |
# YOUR MODEL INFERENCE STOPS HERE
|
74 |
#--------------------------------------------------------------------------------------------
|