You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
train/sft: add type annotations to all Python scripts (#85)
Add comprehensive Python type annotations across all 18 scripts in
train/sft/, improving IDE support and debuggability of raw data dicts.
Changes:
- Define TypedDict classes for recurring data shapes: ShareGPTMessage,
ShareGPTExample, ImageInfo, DatasetInfoEntry, RetrievalRow,
RetrievalHit, SplitStats, EvalResult, EMCharMetrics, JudgeMetrics
- Annotate all function/method signatures (params + return types)
- Type key local variables (accumulators, containers) where not
inferrable from context
Bug fixes discovered during analysis:
- download_tiles.py: collect_paths() had return annotation set[str]
but actually returns dict[str, str | None] — fixed
- prepare_sft_data_variable.py L100: removed dead dict comprehension
expression whose result was discarded
No behavioral changes beyond the dead-code removal. All files pass
ruff check, ruff format, and py_compile.
# Reused from train_contrastors.py — SimpleQA-style grader, returns A/B/C.
31
55
_GRADER_TEMPLATE="""Your job is to look at a question, a gold target, and a predicted answer, and then assign a grade of either ["CORRECT", "INCORRECT", "NOT_ATTEMPTED"].
32
56
Only semantic meaning matters; capitalization, punctuation, grammar, and order don't matter.
@@ -49,7 +73,7 @@
49
73
Just return the letters "A", "B", or "C", with no text around it."""
_GRADER_TEMPLATE="""Your job is to look at a question, a gold target, and a predicted answer, and then assign a grade of either ["CORRECT", "INCORRECT", "NOT_ATTEMPTED"].
27
53
Only semantic meaning matters; capitalization, punctuation, grammar, and order don't matter.
28
54
Hedging and guessing are permissible, provided that the gold target is fully included and the response contains no incorrect information or contradictions.
Copy file name to clipboardExpand all lines: train/sft/generate_think_traces.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,9 @@
29
29
Write a brief reasoning trace (2-3 sentences) showing how someone would find this answer by examining the screenshot. Mention what specific text/detail they would look for. Be natural and concise. No preamble. Output ONLY the reasoning, nothing else."""
0 commit comments