Spaces:
Sleeping
Sleeping
Update tasks/text.py
Browse files- tasks/text.py +2 -10
tasks/text.py
CHANGED
@@ -66,15 +66,6 @@ async def evaluate_text(request: TextEvaluationRequest):
|
|
66 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
67 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
68 |
|
69 |
-
# Load the dataset
|
70 |
-
dataset = load_dataset("quotaclimat/frugalaichallenge-text-train")
|
71 |
-
print(dataset.keys()) # Debugging: Check available splits
|
72 |
-
|
73 |
-
# Assuming 'test' split is available
|
74 |
-
test_dataset = dataset['test']
|
75 |
-
|
76 |
-
# Convert the label strings to integers
|
77 |
-
test_dataset = test_dataset.map(lambda x: {"label": LABEL_MAPPING[x["label"]]})
|
78 |
|
79 |
# Tokenize the test data
|
80 |
test_texts = test_dataset["text"] # Extracting the 'text' column (quotes)
|
@@ -92,7 +83,8 @@ async def evaluate_text(request: TextEvaluationRequest):
|
|
92 |
|
93 |
# Get predictions from the logits (choose the class with the highest logit)
|
94 |
predictions = torch.argmax(logits, dim=-1).cpu().numpy()
|
95 |
-
|
|
|
96 |
|
97 |
#--------------------------------------------------------------------------------------------
|
98 |
# YOUR MODEL INFERENCE STOPS HERE
|
|
|
66 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
67 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
# Tokenize the test data
|
71 |
test_texts = test_dataset["text"] # Extracting the 'text' column (quotes)
|
|
|
83 |
|
84 |
# Get predictions from the logits (choose the class with the highest logit)
|
85 |
predictions = torch.argmax(logits, dim=-1).cpu().numpy()
|
86 |
+
|
87 |
+
true_labels = test_dataset['label']
|
88 |
|
89 |
#--------------------------------------------------------------------------------------------
|
90 |
# YOUR MODEL INFERENCE STOPS HERE
|