MCPcopy Create free account
hub / github.com/BrainCoTech/RevoLab / update_rsl_rl_cfg

Function update_rsl_rl_cfg

scripts/rsl_rl/cli_args.py:60–93  ·  view source on GitHub ↗

Update configuration for RSL-RL agent based on inputs. Args: agent_cfg: The configuration for RSL-RL agent. args_cli: The command line arguments. Returns: The updated configuration for RSL-RL agent based on inputs.

(agent_cfg: RslRlBaseRunnerCfg, args_cli: argparse.Namespace)

Source from the content-addressed store, hash-verified

58
59
60def update_rsl_rl_cfg(agent_cfg: RslRlBaseRunnerCfg, args_cli: argparse.Namespace):
61 """Update configuration for RSL-RL agent based on inputs.
62
63 Args:
64 agent_cfg: The configuration for RSL-RL agent.
65 args_cli: The command line arguments.
66
67 Returns:
68 The updated configuration for RSL-RL agent based on inputs.
69 """
70 # override the default configuration with CLI arguments
71 if hasattr(args_cli, "seed") and args_cli.seed is not None:
72 # randomly sample a seed if seed = -1
73 if args_cli.seed == -1:
74 args_cli.seed = random.randint(0, 10000)
75 agent_cfg.seed = args_cli.seed
76 if args_cli.resume is not None:
77 agent_cfg.resume = args_cli.resume
78 if args_cli.load_run is not None:
79 agent_cfg.load_run = args_cli.load_run
80 if args_cli.checkpoint is not None:
81 agent_cfg.load_checkpoint = args_cli.checkpoint
82 if args_cli.experiment_name is not None:
83 agent_cfg.experiment_name = args_cli.experiment_name
84 if args_cli.run_name is not None:
85 agent_cfg.run_name = args_cli.run_name
86 if args_cli.logger is not None:
87 agent_cfg.logger = args_cli.logger
88 # set the project name for wandb and neptune
89 if agent_cfg.logger in {"wandb", "neptune"} and args_cli.log_project_name:
90 agent_cfg.wandb_project = args_cli.log_project_name
91 agent_cfg.neptune_project = args_cli.log_project_name
92
93 return agent_cfg

Callers 1

parse_rsl_rl_cfgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected