Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Training Launcher — DevOps RL Agent | |
| Usage: | |
| # Test the RL loop (No GPU, uses rule-based Baseline Agent) | |
| python scripts/train.py --test --episodes 100 | |
| # Real GRPO Training (Requires GPU, uses Unsloth + Llama 3.2 3B) | |
| python scripts/train.py --real --episodes 1000 | |
| """ | |
| import argparse | |
| import sys | |
| import os | |
| sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
| from training.train_grpo import GRPODevOpsTrainer | |
| def main(): | |
| parser = argparse.ArgumentParser(description="Launch DevOps Agent Training") | |
| parser.add_argument("--test", action="store_true", help="Run test training (no GPU, uses baseline agent)") | |
| parser.add_argument("--real", action="store_true", help="Run real GRPO training (requires GPU)") | |
| parser.add_argument("--episodes", type=int, default=500, help="Number of episodes to run") | |
| parser.add_argument("--model", type=str, default="unsloth/llama-3.2-3b-instruct", help="Base model for real training") | |
| args = parser.parse_args() | |
| if not args.test and not args.real: | |
| print("Please specify --test or --real. E.g., python scripts/train.py --test") | |
| sys.exit(1) | |
| use_grpo = args.real | |
| trainer = GRPODevOpsTrainer( | |
| model_name=args.model, | |
| max_steps=args.episodes, | |
| save_steps=100 | |
| ) | |
| print(f"Starting {'REAL' if use_grpo else 'TEST'} training for {args.episodes} episodes...") | |
| trainer.train(num_episodes=args.episodes, use_grpo=use_grpo) | |
| if __name__ == "__main__": | |
| main() | |