From a8d9a382cb2e8587d820dae7673713620a008b7f Mon Sep 17 00:00:00 2001 From: Abhiram <22r11a0561@gcet.edu.in> Date: Mon, 30 Mar 2026 14:00:44 +0530 Subject: [PATCH] Add config_loader.py to load YAML configuration --- utils/config_loader.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 utils/config_loader.py diff --git a/utils/config_loader.py b/utils/config_loader.py new file mode 100644 index 00000000..38db7420 --- /dev/null +++ b/utils/config_loader.py @@ -0,0 +1,31 @@ +# utils/config_loader.py +import yaml +import argparse +import sys + +def load_config(config_path): + """Loads a YAML configuration file.""" + try: + with open(config_path, 'r') as file: + config = yaml.safe_load(file) + return config + except FileNotFoundError: + print(f"Error: Configuration file not found at {config_path}") + sys.exit(1) + +def get_config(): + """Parses command line arguments to get the config file path.""" + parser = argparse.ArgumentParser(description="DeepLense Agentic AI Training Pipeline") + + # This allows an AI agent to run: python train.py --config configs/my_custom_config.yaml + parser.add_argument( + '--config', + type=str, + default='configs/transformer_sim.yaml', + help='Path to the YAML configuration file' + ) + + args = parser.parse_args() + config = load_config(args.config) + + return config