Update tasks/text.py
Browse files- tasks/text.py +5 -6
tasks/text.py
CHANGED
|
@@ -55,15 +55,14 @@ async def evaluate_text(request: TextEvaluationRequest):
|
|
| 55 |
username, space_url = get_space_info()
|
| 56 |
|
| 57 |
# Load and prepare the dataset
|
| 58 |
-
dataset = load_dataset(request.dataset_name)
|
| 59 |
|
| 60 |
-
# Convert
|
| 61 |
dataset = dataset.map(lambda x: {"label": LABEL_MAPPING[x["label"]]})
|
| 62 |
|
| 63 |
-
# Split dataset
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
# Start tracking emissions
|
| 68 |
tracker.start()
|
| 69 |
tracker.start_task("inference")
|
|
|
|
| 55 |
username, space_url = get_space_info()
|
| 56 |
|
| 57 |
# Load and prepare the dataset
|
| 58 |
+
dataset = load_dataset(request.dataset_name, token=os.getenv("HF_TOKEN"))
|
| 59 |
|
| 60 |
+
# Convert string labels to integers
|
| 61 |
dataset = dataset.map(lambda x: {"label": LABEL_MAPPING[x["label"]]})
|
| 62 |
|
| 63 |
+
# Split dataset
|
| 64 |
+
test_dataset = dataset["test"]
|
| 65 |
+
|
|
|
|
| 66 |
# Start tracking emissions
|
| 67 |
tracker.start()
|
| 68 |
tracker.start_task("inference")
|