This class sets up all the necessary objects that are required to run any configuration. More...
Inheritance diagram for rlpack.utils.setup.Setup:
Collaboration diagram for rlpack.utils.setup.Setup:Public Member Functions | |
| def | __init__ (self) |
| Union[Activation, List[Activation]] | get_activation (self, Union[str, List[str]] activation_name, Union[Dict[str, Any], List[Dict[str, Any]]] activation_args) |
| This method retrieves the activation to be supplied for the models. More... | |
| Agent | get_agent (self, str agent_name, *args, **kwargs) |
| This method retrieves the agent given the agent name. More... | |
| def | get_agent_model_args (self, str agent_name) |
| Distribution | get_distribution_class (self, str distribution) |
| LossFunction | get_loss_function (self, str loss_function_name, Dict[str, Any] loss_function_args) |
| This method retrieves the Loss Function to be supplied for the models. More... | |
| LRScheduler | get_lr_scheduler (self, pytorch.optim.Optimizer optimizer, Optional[str] lr_scheduler_name=None, Optional[Dict[str, Any]] lr_scheduler_args=None) |
| This method retrieves the lr_scheduler to be supplied for the models if LR Scheduler is requested. More... | |
| List[str] | get_model_args (self, str model_name) |
| List[pytorch.nn.Module] | get_models (self, str model_name, str agent_name, *args, **kwargs) |
| This method automatically retrieves the given model(s) required by the agent. More... | |
| pytorch.optim.Optimizer | get_optimizer (self, List[pytorch.Tensor] params, str optimizer_name, Dict[str, Any] optimizer_args) |
| This method retrieves the optimizer given by the "optimizer" key in the argument optimizer_args. More... | |
| def | __init__ (self) |
| def | __init__ (self) |
Additional Inherited Members | |
Static Public Member Functions inherited from rlpack.utils.base.register.Register | |
| def | get_prefix_path () |
| Gets prefix path for rlpack package, from python installation. More... | |
Data Fields inherited from rlpack.utils.base.register.Register | |
| activation_init_args | |
| The activation initialization arguments when using in-built models. More... | |
| activation_map | |
| The mapping between given keyword and PyTorch activation function class. More... | |
| agent_args | |
| The mapping between given keyword and agent agents' arguments. More... | |
| agent_args_default | |
| The mapping between given keyword and agent agent's default arguments. More... | |
| agent_init_args | |
| The mandatory agent initialisation arguments. More... | |
| agents | |
| The mapping between given keyword and agents models. More... | |
| distributions_map | |
| The mapping between given keyword and PyTorch Distribution class. More... | |
| loss_function_map | |
| The mapping between given keyword and PyTorch loss function class. More... | |
| lr_scheduler_init_args | |
| The LR Scheduler initialization arguments. More... | |
| lr_scheduler_map | |
| The mapping between given keyword and PyTorch LR Scheduler class. More... | |
| mandatory_distributed_agents | |
| mandatory_distribution_required_agents | |
| mandatory_keys | |
| The tuple for mandatory keys (or keyword arguments) always expected. More... | |
| model_args | |
| The mapping between given keyword and in-built models' arguments. More... | |
| model_args_default | |
| The mapping between given keyword and in-built model's default arguments. More... | |
| model_args_to_optimize | |
| The mapping between keyword and agents' model arguments to wrap optimizer with. More... | |
| model_init_args | |
| The model initialization arguments when using in-built models. More... | |
| models | |
| The mapping between given keyword and in-built models. More... | |
| optimizer_init_args | |
| The optimizer initialization arguments for given models. More... | |
| optimizer_map | |
| The mapping between given keyword and PyTorch optimizer class. More... | |
Data Fields inherited from rlpack.utils.base.internal_code_register.InternalCodeRegister | |
| norm_mode_codes | |
| The mapping between given keyword and normalisation method codes. More... | |
| norm_to_mode_codes | |
The mapping between given keyword and normalisation quantity (apply_norm_to) codes. More... | |
| prioritization_strategy_codes | |
| The mapping between prioritization strategy keywords and prioritization strategy codes. More... | |
This class sets up all the necessary objects that are required to run any configuration.
| def rlpack.utils.setup.Setup.__init__ | ( | self | ) |
Reimplemented from rlpack.utils.base.internal_code_register.InternalCodeRegister.
| Union[Activation, List[Activation]] rlpack.utils.setup.Setup.get_activation | ( | self, | |
| Union[str, List[str]] | activation_name, | ||
| Union[Dict[str, Any], List[Dict[str, Any]]] | activation_args | ||
| ) |
This method retrieves the activation to be supplied for the models.
If list is passed, list of initialized activation objects are retrieved.
| activation_name | Union[str, List[str]]: The activation name to be used. |
| activation_args | DUnion[Dict[str, Any], List[Dict[str, Any]]]: A dictionary with keyword arguments for to-be initialized activation function. |
| Agent rlpack.utils.setup.Setup.get_agent | ( | self, | |
| str | agent_name, | ||
| * | args, | ||
| ** | kwargs | ||
| ) |
This method retrieves the agent given the agent name.
| agent_name | str: The agent to retrieve. |
| args | The additional positional arguments for the model. |
| kwargs | The additional keyword arguments required by the model. |
| def rlpack.utils.setup.Setup.get_agent_model_args | ( | self, | |
| str | agent_name | ||
| ) |
| Distribution rlpack.utils.setup.Setup.get_distribution_class | ( | self, | |
| str | distribution | ||
| ) |
| LossFunction rlpack.utils.setup.Setup.get_loss_function | ( | self, | |
| str | loss_function_name, | ||
| Dict[str, Any] | loss_function_args | ||
| ) |
This method retrieves the Loss Function to be supplied for the models.
| loss_function_name | str: The loss function's name to be used. |
| loss_function_args | Dict[str, Any]: A dictionary with keyword arguments for to-be initialized loss function. :return (LossFunction): The initialized loss function. |
| LRScheduler rlpack.utils.setup.Setup.get_lr_scheduler | ( | self, | |
| pytorch.optim.Optimizer | optimizer, | ||
| Optional[str] | lr_scheduler_name = None, |
||
| Optional[Dict[str, Any]] | lr_scheduler_args = None |
||
| ) |
This method retrieves the lr_scheduler to be supplied for the models if LR Scheduler is requested.
| optimizer | pytorch.optim.Optimizer: The optimizer to wrap the lr scheduler around. |
| lr_scheduler_name | str: The LR Scheduler's name to be used. |
| lr_scheduler_args | Dict[str, Any]: A dictionary with keyword arguments for to-be initialized LR Scheduler. |
| List[str] rlpack.utils.setup.Setup.get_model_args | ( | self, | |
| str | model_name | ||
| ) |
| model_name | str: The model name for which we want to obtain the args. |
| List[pytorch.nn.Module] rlpack.utils.setup.Setup.get_models | ( | self, | |
| str | model_name, | ||
| str | agent_name, | ||
| * | args, | ||
| ** | kwargs | ||
| ) |
This method automatically retrieves the given model(s) required by the agent.
| model_name | str: The initialized model for the supplied model_name. |
| agent_name | str: The agent name for which models are requested. |
| args | Additional positional arguments for the model. |
| kwargs | Additional keyword arguments for the model. |
| pytorch.optim.Optimizer rlpack.utils.setup.Setup.get_optimizer | ( | self, | |
| List[pytorch.Tensor] | params, | ||
| str | optimizer_name, | ||
| Dict[str, Any] | optimizer_args | ||
| ) |
This method retrieves the optimizer given by the "optimizer" key in the argument optimizer_args.
| params | List[pytorch.Tensor]: The model parameters to wrap the optimizer. |
| optimizer_name | str: The optimizer name to be used. |
| optimizer_args | Dict[str, Any]: A dictionary with keyword arguments for to-be initialized optimizer. |