#917 - Synced with dev and added better logging

This commit is contained in:
Chris McCarthy
2023-06-28 12:01:01 +01:00
parent edab1a393d
commit a9ebfd7917
12 changed files with 170 additions and 87 deletions

View File

@@ -38,26 +38,23 @@ hard_coded_agent_view: FULL
action_type: ANY
# Number of episodes to run per session
num_episodes: 100
num_episodes: 10
# Number of time_steps per episode
num_steps: 256
# Sets how often the agent will save a checkpoint (every n time episodes).
# Set to 0 if no checkpoints are required. Default is 10
checkpoint_every_n_episodes: 100
checkpoint_every_n_episodes: 10
# Time delay between steps (for generic agents)
time_delay: 3
time_delay: 5
# Type of session to be run (TRAINING or EVALUATION)
session_type: TRAINING
# Determine whether to load an agent from file
load_agent: False
# File path and file name of agent if you're loading one in
agent_load_file: C:\[Path]\[agent_saved_filename.zip]
# Type of session to be run. Options are:
# "TRAIN" (Trains an agent)
# "EVAL" (Evaluates an agent)
# "TRAIN_EVAL" (Trains then evaluates an agent)
session_type: TRAIN
# Environment config values
# The high value for the observation space

View File

@@ -69,7 +69,7 @@ class TrainingConfig:
"The delay between steps (ms). Applies to generic agents only"
# file
session_type: SessionType = SessionType.TRAINING
session_type: SessionType = SessionType.TRAIN
"The type of PrimAITE session to run"
load_agent: str = False
@@ -171,6 +171,7 @@ class TrainingConfig:
file_system_scanning_limit: int = 5
"The time taken to scan the file system"
@classmethod
def from_dict(
cls,
@@ -183,7 +184,7 @@ class TrainingConfig:
"action_type": ActionType,
"session_type": SessionType,
"output_verbose_level": OutputVerboseLevel,
"hard_coded_agent_view": HardCodedAgentView
"hard_coded_agent_view": HardCodedAgentView,
}
for field, enum_class in field_enum_map.items():
@@ -211,6 +212,20 @@ class TrainingConfig:
return data
def __str__(self) -> str:
tc = f"TrainingConfig(agent_framework={self.agent_framework.name}, "
if self.agent_framework is AgentFramework.RLLIB:
tc += f"deep_learning_framework=" \
f"{self.deep_learning_framework.name}, "
tc += f"agent_identifier={self.agent_identifier.name}, "
if self.agent_identifier is AgentIdentifier.HARDCODED:
tc += f"hard_coded_agent_view={self.hard_coded_agent_view.name}, "
tc += f"action_type={self.action_type.name}, "
tc += f"observation_space={self.observation_space}, "
tc += f"num_episodes={self.num_episodes}, "
tc += f"num_steps={self.num_steps})"
return tc
def load(
file_path: Union[str, Path],