-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
59 lines (49 loc) · 1.85 KB
/
Copy pathmain.py
File metadata and controls
59 lines (49 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# main.py
import argparse
import io
import sys
from pathlib import Path
from validator.validator import SFTValidator
# Ensure stdout is UTF-8 on all platforms (defense-in-depth for Windows cp1252)
if hasattr(sys.stdout, 'buffer'):
sys.stdout = io.TextIOWrapper(
sys.stdout.buffer,
encoding='utf-8',
errors='replace',
)
def run_pipeline(input_path: str, clean_path: str, report_path: str):
"""Executes the validation pipeline and provides console feedback."""
print(f" Starting TamilLM SFT Validation Pipeline...")
print(f" Input: {input_path}")
print(f" Clean: {clean_path}")
print(f" Report: {report_path}")
validator = SFTValidator()
records = validator.load_records(Path(input_path))
print(f" Running checks on {len(records)} records...")
validator.validate(records)
report = validator.write_outputs(
clean_path=Path(clean_path),
report_path=Path(report_path),
)
print(" Validation Pipeline Completed Successfully!")
return report
def main():
parser = argparse.ArgumentParser(
description="Run the Tamil SFT Validation Pipeline"
)
# Adding default values so the user can just run `python3 main.py`
parser.add_argument("--input", default="data/tamil_sft_seed.jsonl",
help="Input JSONL file")
parser.add_argument("--clean", default="outputs/clean.jsonl",
help="Output path for clean records")
parser.add_argument("--report", default="outputs/validation_report.json",
help="Output path for validation report JSON")
args = parser.parse_args()
try:
run_pipeline(args.input, args.clean, args.report)
sys.exit(0)
except Exception as e:
print(f"Pipeline failed: {e}")
sys.exit(1)
if __name__ == "__main__":
main()