GlobalSession
- class lib.gui.analysis.stats.GlobalSession
Bases:
objectHolds information about a loaded or current training session by accessing a model’s state file and Tensorboard logs. This class should not be accessed directly, rather through
lib.gui.analysis.SessionAttributes Summary
The batch sizes for each session_id for the model.
List of dictionaries containing summary statistics for each session id.
Trueif session data is available otherwiseFalseTrueif session data is loaded otherwiseFalseTrueif the loaded session is the currently training model, otherwiseFalseTrueif logging is disabled for the currently training session otherwiseFalse.The full model filename
The sorted list of all existing session ids in the state file
Methods Summary
clear()Clear the currently loaded session.
get_loss(session_id)Obtain the loss values for the given session_id.
get_loss_keys(session_id)Obtain the loss keys for the given session_id.
get_timestamps(-> dict[int, ~numpy.ndarray])Obtain the time stamps keys for the given session_id.
initialize_session(model_folder, model_name)Initialize a Session.
Clears the internal training flag.
Attributes Documentation
- batch_sizes
The batch sizes for each session_id for the model.
- Type:
dict
- full_summary
List of dictionaries containing summary statistics for each session id.
- Type:
list
- have_session_data
Trueif session data is available otherwiseFalse- Type:
bool
- is_loaded
Trueif session data is loaded otherwiseFalse- Type:
bool
- is_training
Trueif the loaded session is the currently training model, otherwiseFalse- Type:
bool
- logging_disabled
Trueif logging is disabled for the currently training session otherwiseFalse.- Type:
bool
- model_filename
The full model filename
- Type:
str
- session_ids
The sorted list of all existing session ids in the state file
- Type:
list
Methods Documentation
- clear() None
Clear the currently loaded session.
- Return type:
None
- get_loss(session_id: int | None) dict[str, ndarray]
Obtain the loss values for the given session_id.
- Parameters:
session_id (int or
None) – The session ID to return loss for. PassNoneto return loss for all sessions.- Returns:
Loss names as key,
numpy.ndarrayas value. If No session ID was provided all session’s losses are collated- Return type:
dict
- get_loss_keys(session_id: int | None) list[str]
Obtain the loss keys for the given session_id.
- Parameters:
session_id (int or
None) – The session ID to return the loss keys for. PassNoneto return loss keys for all sessions.- Returns:
The loss keys for the given session. If
Noneis passed as session_id then a unique list of all loss keys for all sessions is returned- Return type:
list
- get_timestamps(session_id: None) dict[int, ndarray]
- get_timestamps(session_id: int) ndarray
Obtain the time stamps keys for the given session_id.
- Parameters:
session_id (int or
None) – The session ID to return the time stamps for. PassNoneto return time stamps for all sessions.- Returns:
If a session ID has been given then a single
numpy.ndarraywill be returned with the session’s time stamps. Otherwise a ‘dict’ will be returned with the session IDs as key withnumpy.ndarrayof timestamps as values- Return type:
dict[int] or
numpy.ndarray
- initialize_session(model_folder: str, model_name: str, is_training: bool = False) None
Initialize a Session.
Load’s the model’s state file, and sets the paths to any underlying Tensorboard logs, ready for access on request.
- Parameters:
model_folder (str,) – If loading a session manually (e.g. for the analysis tab), then the path to the model folder must be provided. For training sessions, this should be passed through from the launcher
model_name (str, optional) – If loading a session manually (e.g. for the analysis tab), then the model filename must be provided. For training sessions, this should be passed through from the launcher
is_training (bool, optional) –
Trueif the session is being initialized for a training session, otherwiseFalse. Default:False
- Return type:
None
- stop_training() None
Clears the internal training flag. To be called when training completes.
- Return type:
None
- property batch_sizes: dict[int, int]
The batch sizes for each session_id for the model.
- Type:
dict
- clear() None
Clear the currently loaded session.
- Return type:
None
- property full_summary: list[dict]
List of dictionaries containing summary statistics for each session id.
- Type:
list
- get_loss(session_id: int | None) dict[str, ndarray]
Obtain the loss values for the given session_id.
- Parameters:
session_id (int or
None) – The session ID to return loss for. PassNoneto return loss for all sessions.- Returns:
Loss names as key,
numpy.ndarrayas value. If No session ID was provided all session’s losses are collated- Return type:
dict
- get_loss_keys(session_id: int | None) list[str]
Obtain the loss keys for the given session_id.
- Parameters:
session_id (int or
None) – The session ID to return the loss keys for. PassNoneto return loss keys for all sessions.- Returns:
The loss keys for the given session. If
Noneis passed as session_id then a unique list of all loss keys for all sessions is returned- Return type:
list
- get_timestamps(session_id: None) dict[int, ndarray]
- get_timestamps(session_id: int) ndarray
Obtain the time stamps keys for the given session_id.
- Parameters:
session_id (int or
None) – The session ID to return the time stamps for. PassNoneto return time stamps for all sessions.- Returns:
If a session ID has been given then a single
numpy.ndarraywill be returned with the session’s time stamps. Otherwise a ‘dict’ will be returned with the session IDs as key withnumpy.ndarrayof timestamps as values- Return type:
dict[int] or
numpy.ndarray
- property have_session_data: bool
Trueif session data is available otherwiseFalse- Type:
bool
- initialize_session(model_folder: str, model_name: str, is_training: bool = False) None
Initialize a Session.
Load’s the model’s state file, and sets the paths to any underlying Tensorboard logs, ready for access on request.
- Parameters:
model_folder (str,) – If loading a session manually (e.g. for the analysis tab), then the path to the model folder must be provided. For training sessions, this should be passed through from the launcher
model_name (str, optional) – If loading a session manually (e.g. for the analysis tab), then the model filename must be provided. For training sessions, this should be passed through from the launcher
is_training (bool, optional) –
Trueif the session is being initialized for a training session, otherwiseFalse. Default:False
- Return type:
None
- property is_loaded: bool
Trueif session data is loaded otherwiseFalse- Type:
bool
- property is_training: bool
Trueif the loaded session is the currently training model, otherwiseFalse- Type:
bool
- property logging_disabled: bool
Trueif logging is disabled for the currently training session otherwiseFalse.- Type:
bool
- property model_filename: str
The full model filename
- Type:
str
- property session_ids: list[int]
The sorted list of all existing session ids in the state file
- Type:
list
- stop_training() None
Clears the internal training flag. To be called when training completes.
- Return type:
None