Sync from GitHub via hub-sync
Browse files
classify-dataset-sglang.py
CHANGED
|
@@ -9,10 +9,12 @@
|
|
| 9 |
# "datasets",
|
| 10 |
# "huggingface-hub[hf_transfer]",
|
| 11 |
# ]
|
| 12 |
-
#
|
| 13 |
-
# [
|
| 14 |
-
#
|
| 15 |
-
#
|
|
|
|
|
|
|
| 16 |
# ///
|
| 17 |
|
| 18 |
"""
|
|
@@ -271,14 +273,14 @@ def classify_batch_with_sglang(
|
|
| 271 |
original_idx = valid_indices[idx]
|
| 272 |
|
| 273 |
# The output text should be just the label due to EBNF constraint
|
| 274 |
-
classification = output
|
| 275 |
|
| 276 |
# Extract reasoning if present and requested
|
| 277 |
reasoning = None
|
| 278 |
if args.reasoning and args.save_reasoning:
|
| 279 |
# Get the full output including reasoning
|
| 280 |
# Note: We need to check if SGLang provides access to full output with reasoning
|
| 281 |
-
reasoning = parse_reasoning_output(output
|
| 282 |
|
| 283 |
results[original_idx] = {
|
| 284 |
"label": classification,
|
|
|
|
| 9 |
# "datasets",
|
| 10 |
# "huggingface-hub[hf_transfer]",
|
| 11 |
# ]
|
| 12 |
+
#
|
| 13 |
+
# [tool.hf-jobs]
|
| 14 |
+
# image = "lmsysorg/sglang:v0.5.20-cu130"
|
| 15 |
+
# flavor = "l4x1"
|
| 16 |
+
# secrets = ["HF_TOKEN"]
|
| 17 |
+
# timeout = "1h"
|
| 18 |
# ///
|
| 19 |
|
| 20 |
"""
|
|
|
|
| 273 |
original_idx = valid_indices[idx]
|
| 274 |
|
| 275 |
# The output text should be just the label due to EBNF constraint
|
| 276 |
+
classification = output["text"].strip().strip('"') # Remove quotes if present
|
| 277 |
|
| 278 |
# Extract reasoning if present and requested
|
| 279 |
reasoning = None
|
| 280 |
if args.reasoning and args.save_reasoning:
|
| 281 |
# Get the full output including reasoning
|
| 282 |
# Note: We need to check if SGLang provides access to full output with reasoning
|
| 283 |
+
reasoning = parse_reasoning_output(output["text"], classification)
|
| 284 |
|
| 285 |
results[original_idx] = {
|
| 286 |
"label": classification,
|