File size: 1,782 Bytes
c8c00f0 | 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 | import subprocess
import sys
# Common base arguments across all runs
BASE_CMD = [
sys.executable, # Uses the currently active Python interpreter
"batch_agent_orchestrator.py",
"--input-dir", r"C:\Users\admin_mtds\OneDrive\Desktop\ChinKuan\TestingImage\01_bubble_sensor",
"--output-dir", r"C:\Users\admin_mtds\OneDrive\Desktop\ChinKuan\ArtiAgent - Defect\agent_output",
"--defectdiffu-ckpt", r"C:\Users\admin_mtds\OneDrive\Desktop\ChinKuan\ArtiAgent - Defect\engine\DefectDiffu\checkpoint_old-4\model_300.pth",
"--vae-path", r"C:\Users\admin_mtds\OneDrive\Desktop\ChinKuan\ArtiAgent - Defect\engine\DefectDiffu\checkpoints\sd-vae-ft-mse",
"--product-desc", "VCSEL laser diode with emission aperture and surrounding mesa",
"--max-defects-per-image", "3",
"--device", "cuda"
]
# Variations for each step in a single loop
TASKS = [
["--defect-type", "tiger-strip"],
["--defect-type", "bubble"],
[] # Default/No defect-type specified
]
TOTAL_LOOPS = 16
if __name__ == "__main__":
for loop_num in range(1, TOTAL_LOOPS + 1):
print(f"\n" + "=" * 50)
print(f"๐ STARTING LOOP {loop_num} OF {TOTAL_LOOPS}")
print("=" * 50)
for step_idx, task_args in enumerate(TASKS, start=1):
full_command = BASE_CMD + task_args
print(f"\n--> Running Task {step_idx}/3 for Loop {loop_num}...")
# Run command and block until it completes
result = subprocess.run(full_command)
# Check if command failed
if result.returncode != 0:
print(f"โ Error encountered on Loop {loop_num}, Task {step_idx}. Execution stopped.")
sys.exit(result.returncode)
print("\n๐ Success! Completed all 16 loops.") |