MCPcopy Create free account
hub / github.com/TeleHuman/PBHC / main

Function main

humanoidverse/eval_agent.py:56–197  ·  view source on GitHub ↗
(override_config: OmegaConf)

Source from the content-addressed store, hash-verified

54@hydra.main(config_path="config", config_name="base_eval")
55# @pdb_decorator
56def main(override_config: OmegaConf):
57 # logging to hydra log file
58 hydra_log_path = os.path.join(HydraConfig.get().runtime.output_dir, "eval.log")
59 logger.remove()
60 logger.add(hydra_log_path, level="DEBUG")
61
62 # Get log level from LOGURU_LEVEL environment variable or use INFO as default
63 console_log_level = os.environ.get("LOGURU_LEVEL", "INFO").upper()
64 logger.add(sys.stdout, level=console_log_level, colorize=True)
65
66 logging.basicConfig(level=logging.DEBUG)
67 logging.getLogger().addHandler(HydraLoggerBridge())
68
69 os.chdir(hydra.utils.get_original_cwd())
70
71 if override_config.checkpoint is not None:
72 has_config = True
73 checkpoint = Path(override_config.checkpoint)
74 config_path = checkpoint.parent / "config.yaml"
75 if not config_path.exists():
76 config_path = checkpoint.parent.parent / "config.yaml"
77 if not config_path.exists():
78 has_config = False
79 logger.error(f"Could not find config path: {config_path}")
80
81 if has_config:
82 logger.info(f"Loading training config file from {config_path}")
83 with open(config_path) as file:
84 train_config = OmegaConf.load(file)
85
86 if train_config.eval_overrides is not None:
87 train_config = OmegaConf.merge(
88 train_config, train_config.eval_overrides
89 )
90
91 config = OmegaConf.merge(train_config, override_config)
92 else:
93 config = override_config
94 else:
95 if override_config.eval_overrides is not None:
96 config = override_config.copy()
97 eval_overrides = OmegaConf.to_container(config.eval_overrides, resolve=True)
98 for arg in sys.argv[1:]:
99 if not arg.startswith("+"):
100 key = arg.split("=")[0]
101 if key in eval_overrides:
102 del eval_overrides[key]
103 config.eval_overrides = OmegaConf.create(eval_overrides)
104 config = OmegaConf.merge(config, eval_overrides)
105 else:
106 config = override_config
107
108 simulator_type = config.simulator['_target_'].split('.')[-1]
109 if simulator_type == 'IsaacSim':
110 from omni.isaac.lab.app import AppLauncher
111 import argparse
112 parser = argparse.ArgumentParser(description="Evaluate an RL agent with RSL-RL.")
113 AppLauncher.add_app_launcher_args(parser)

Callers 1

eval_agent.pyFile · 0.70

Calls 12

HydraLoggerBridgeClass · 0.90
pre_process_configFunction · 0.90
export_policy_as_jitFunction · 0.90
export_policy_as_onnxFunction · 0.90
createMethod · 0.80
addMethod · 0.45
loadMethod · 0.45
saveMethod · 0.45
setupMethod · 0.45
get_example_obsMethod · 0.45
evaluate_policyMethod · 0.45

Tested by

no test coverage detected