-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_pipeline.py
More file actions
39 lines (31 loc) · 1.16 KB
/
Copy pathrun_pipeline.py
File metadata and controls
39 lines (31 loc) · 1.16 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
from pathlib import Path
import subprocess
import sys
import argparse
def run_step(script_name: str, extra_args: list[str] | None = None) -> None:
root = Path(__file__).resolve().parent
script_path = root / "SRC" / script_name
if not script_path.exists():
raise FileNotFoundError(f"Missing script: {script_path}")
print(f"\n=== Running {script_name} ===")
command = [sys.executable, str(script_path)]
if extra_args:
command.extend(extra_args)
result = subprocess.run(command, check=False)
if result.returncode != 0:
raise RuntimeError(f"Step failed: {script_name} (exit code {result.returncode})")
def main() -> None:
parser = argparse.ArgumentParser(description="Run full sentiment pipeline.")
parser.add_argument(
"--fast",
action="store_true",
help="Run training in smoke-test mode for a quick pipeline check.",
)
args = parser.parse_args()
train_args = ["--smoke-test"] if args.fast else None
run_step("Train.py", train_args)
run_step("Evaluate_Model.py")
run_step("Inference.py")
print("\nPipeline completed successfully.")
if __name__ == "__main__":
main()