tbp.monty.frameworks.loggers#
tbp.monty.frameworks.loggers.exp_logger#
- class BaseMontyLogger(handlers)[source]#
Bases:
objectBasic logger that logs or saves information when logging is called.
- class LoggingCallbackHandler(loggers, model, output_dir)[source]#
Bases:
objectCalls a list of loggers on an event (eg post_train).
Each logger receives: logger_args: dict with time stamps (steps, epochs, etc.) and
env_interface.primary_target which contains object id and pose
output_dir: Full path of the directory to store log files
Note
This logger handler is intended primarily for logging
- property logger_list#
- class TestLogger(handlers)[source]#
Bases:
BaseMontyLogger
tbp.monty.frameworks.loggers.graph_matching_loggers#
- class BasicGraphMatchingLogger(handlers)[source]#
Bases:
BaseMontyLoggerBasic logger that logs or saves information when logging is called.
- maybe_log(logger_args, output_dir, model)[source]#
Left here in case we go back to size based logging.
Remove if not used after code has stabilized.
- class DetailedGraphMatchingLogger(handlers)[source]#
Bases:
BasicGraphMatchingLoggerLog detailed stats as .json file by saving data for each LM and SM.
- class SelectiveEvidenceLogger(handlers)[source]#
Bases:
BasicGraphMatchingLoggerLog evidences as .json file by saving data for each LM and SM.
This is slimmed down to only log data needed for object similarity analysis. Data logged:
evidences for each object and pose at the end of an episode
first frame of the view finder
tbp.monty.frameworks.loggers.monty_handlers#
- class BasicCSVStatsHandler[source]#
Bases:
MontyHandlerGrab any logs at the BASIC level and append to train or eval CSV files.
- __init__()[source]#
Initialize with empty dictionary to keep track of writes per file.
We only want to include the header the first time we write to a file. This keeps track of writes per file so we can format the file properly.
- class DetailedJSONHandler(detailed_episodes_to_save: Container[int] | Literal['all'] = 'all', detailed_save_per_episode: bool = False, episode_id_parallel: int | None = None) None[source]#
Bases:
MontyHandlerGrab any logs at the DETAILED level and append to a json file.
- __init__(detailed_episodes_to_save: Container[int] | Literal['all'] = 'all', detailed_save_per_episode: bool = False, episode_id_parallel: int | None = None) None[source]#
Initialize the DetailedJSONHandler.
- Parameters:
detailed_episodes_to_save (Container[int] | Literal[‘all’]) – Container of episodes to save or the string
"all"(default) to include every episode.detailed_save_per_episode (bool) – Whether to save individual episode files or consolidate into a single detailed_run_stats.json file. Defaults to False.
episode_id_parallel (int | None) – Episode id associated with current run, used to identify the episode when using run_parallel.
- get_detailed_stats(data, global_episode_id: int, local_episode: int, mode: Literal['train', 'eval']) dict[source]#
Get detailed episode stats.
- Returns:
Episode stats.
- Return type:
stats
- get_episode_id(local_episode, mode: Literal['train', 'eval'], **kwargs) int[source]#
Get global episode id corresponding to a mode-local episode index.
This function is needed to determine correct episode id when using run_parallel.
- Returns:
Combined train+eval episode id.
- Return type:
global_episode_id
tbp.monty.frameworks.loggers.wandb_handlers#
- class BasicWandbChartStatsHandler[source]#
Bases:
WandbHandlerLog LM episode stats to wandb with one chart per measure.
- get_safe_columns_per_lm(stats)[source]#
Format each episode by looping over learning modules and formatting each one.
- Parameters:
stats – dict ~ {LM_0: dict, LM_1: dict}
- Returns:
The formatted stats.
- class BasicWandbTableStatsHandler[source]#
Bases:
WandbHandlerLog LM episode stats to wandb as tables.
- class DetailedWandbHandler[source]#
Bases:
WandbHandlerMake animations from sequences of observations on wandb.
NOTE: not yet generalized for different model architectures. This assumes SM_0 is the patch, SM_1 is the view finder.
- class DetailedWandbMarkedObsHandler[source]#
Bases:
DetailedWandbHandlerJust like DetailedWandbHandler, but use fancier observations.
- NOTE: this assumes sm1 and sm0 are the view finder and patch modules respectively,
meaning this logger is specific to the model architecture
- NOTE: this is slow, adding ~ a few seconds per function call. The intended use
case is for debugging and error analysis, so speed should not be an issue when the number of episodes is small. But probably do not use this fi you are running a large number of experiments.
- class DetailedWandbTableStatsHandler[source]#
Bases:
BasicWandbTableStatsHandlerLog LM stats and actions to wandb as tables.
This is a modified version of BasicWandbTableStatsHandler that, in addition to the stats, logs the actions exectuted in each episode to wandb as tables (one table per episode).
- class WandbHandler[source]#
Bases:
MontyHandlerParent class for wandb loggers.
- classmethod log_level()[source]#
Handlers filter information from the data they receive.
This class method specifies the level they filter at.
- class WandbWrapper(wandb_handlers: list, run_name: str, wandb_group: str | None = None, config: dict | None = None, resume_wandb_run: bool = False, wandb_id: str | None = None)[source]#
Bases:
MontyHandlerContainer for wandb handlers.
Loops over a series of handlers which log different information without commiting (sending it to wandb).
The wrapper finally commits all logs at once. This allows us to maintain control over the wandb global step. This class assumes reporting takes place once per episode, hence the wandb handlers have report_episode methods.
- __init__(wandb_handlers: list, run_name: str, wandb_group: str | None = None, config: dict | None = None, resume_wandb_run: bool = False, wandb_id: str | None = None)[source]#