#917 - Dropped VerboseLevel in enums.py and changed OutputVerboseLevel to SB3OutputVerboseLevel

This commit is contained in:
Chris McCarthy
2023-06-30 17:09:50 +01:00
parent 27ca53878a
commit 16534237e0
6 changed files with 16 additions and 30 deletions

View File

@@ -57,7 +57,7 @@ class AgentSessionABC(ABC):
lay_down_config_path = Path(lay_down_config_path)
self._lay_down_config_path: Final[Union[Path]] = lay_down_config_path
self._lay_down_config: Dict = lay_down_config.load(self._lay_down_config_path)
self.output_verbose_level = self._training_config.output_verbose_level
self.sb3_output_verbose_level = self._training_config.sb3_output_verbose_level
self._env: Primaite
self._agent = None

View File

@@ -56,7 +56,7 @@ class SB3Agent(AgentSessionABC):
self._agent = self._agent_class(
PPOMlp,
self._env,
verbose=self.output_verbose_level,
verbose=self.sb3_output_verbose_level,
n_steps=self._training_config.num_steps,
tensorboard_log=str(self._tensorboard_log_path),
)

View File

@@ -92,14 +92,6 @@ class SessionType(Enum):
"Train then evaluate an agent"
class VerboseLevel(IntEnum):
"""PrimAITE Session Output verbose level."""
NO_OUTPUT = 0
INFO = 1
DEBUG = 2
class AgentFramework(Enum):
"""The agent algorithm framework/package."""
@@ -199,12 +191,9 @@ class LinkStatus(Enum):
OVERLOAD = 4
class OutputVerboseLevel(IntEnum):
"""The Agent output verbosity level."""
class SB3OutputVerboseLevel(IntEnum):
"""The Stable Baselines3 learn/eval output verbosity level."""
NONE = 0
"No Output"
INFO = 1
"Info Messages"
ALL = 2
"All Messages"
DEBUG = 2

View File

@@ -60,12 +60,12 @@ session_type: TRAIN_EVAL
# The high value for the observation space
observation_space_high_value: 1000000000
# The Agent output verbosity level:
# The Stable Baselines3 learn/eval output verbosity level:
# Options are:
# "NONE" (No Output)
# "INFO" (Info Messages)
# "ALL" (All Messages)
output_verbose_level: NONE
# "INFO" (Info Messages (such as devices and wrappers used))
# "DEBUG" (All Messages)
sb3_output_verbose_level: NONE
# Reward values
# Generic

View File

@@ -14,7 +14,7 @@ from primaite.common.enums import (
AgentIdentifier,
DeepLearningFramework,
HardCodedAgentView,
OutputVerboseLevel,
SB3OutputVerboseLevel,
SessionType,
)
@@ -86,8 +86,8 @@ class TrainingConfig:
observation_space_high_value: int = 1000000000
"The high value for the observation space"
output_verbose_level: OutputVerboseLevel = OutputVerboseLevel.INFO
"The Agent output verbosity level"
sb3_output_verbose_level: SB3OutputVerboseLevel = SB3OutputVerboseLevel.NONE
"Stable Baselines3 learn/eval output verbosity level"
# Reward values
# Generic
@@ -189,7 +189,7 @@ class TrainingConfig:
"agent_identifier": AgentIdentifier,
"action_type": ActionType,
"session_type": SessionType,
"output_verbose_level": OutputVerboseLevel,
"sb3_output_verbose_level": SB3OutputVerboseLevel,
"hard_coded_agent_view": HardCodedAgentView,
}
@@ -212,7 +212,7 @@ class TrainingConfig:
data["deep_learning_framework"] = self.deep_learning_framework.name
data["agent_identifier"] = self.agent_identifier.name
data["action_type"] = self.action_type.name
data["output_verbose_level"] = self.output_verbose_level.name
data["sb3_output_verbose_level"] = self.sb3_output_verbose_level.name
data["session_type"] = self.session_type.name
data["hard_coded_agent_view"] = self.hard_coded_agent_view.name
@@ -277,7 +277,6 @@ def convert_legacy_training_config_dict(
agent_identifier: AgentIdentifier = AgentIdentifier.PPO,
action_type: ActionType = ActionType.ANY,
num_steps: int = 256,
output_verbose_level: OutputVerboseLevel = OutputVerboseLevel.INFO,
) -> Dict[str, Any]:
"""
Convert a legacy training config dict to the new format.
@@ -291,8 +290,6 @@ def convert_legacy_training_config_dict(
don't have action_type values.
:param num_steps: The number of steps to set as legacy training configs
don't have num_steps values.
:param output_verbose_level: The agent output verbose level to use as
legacy training configs don't have output_verbose_level values.
:return: The converted training config dict.
"""
config_dict = {
@@ -300,7 +297,7 @@ def convert_legacy_training_config_dict(
"agent_identifier": agent_identifier.name,
"action_type": action_type.name,
"num_steps": num_steps,
"output_verbose_level": output_verbose_level.name,
"sb3_output_verbose_level": SB3OutputVerboseLevel.INFO.name,
}
session_type_map = {"TRAINING": "TRAIN", "EVALUATION": "EVAL"}
legacy_config_dict["sessionType"] = session_type_map[legacy_config_dict["sessionType"]]

View File

@@ -75,7 +75,7 @@ class PrimaiteSession:
raise ValueError
elif self._training_config.agent_identifier == AgentIdentifier.DO_NOTHING:
_LOGGER.debug(f"PrimaiteSession Setup: Agent Identifier =" f" {AgentIdentifier.DO_NOTHINGD}")
_LOGGER.debug(f"PrimaiteSession Setup: Agent Identifier =" f" {AgentIdentifier.DO_NOTHING}")
if self._training_config.action_type == ActionType.NODE:
self._agent_session = DoNothingNodeAgent(self._training_config_path, self._lay_down_config_path)