message_passing
- class aitoolbox.torchtrain.train_loop.components.message_passing.MessageHandling(value)[source]
Bases:
Enum
An enumeration.
- KEEP_FOREVER = 'keep_forever'
- UNTIL_END_OF_EPOCH = 'until_end_of_epoch'
- UNTIL_READ = 'until_read'
- OVERWRITE = 'overwrite'
- class aitoolbox.torchtrain.train_loop.components.message_passing.Message(key, value, msg_handling_settings)[source]
Bases:
object
Wrapper object to represent the messages in the MessageService together with their handling settings
- Parameters:
key (str) – message key
value – message value
msg_handling_settings (MessageHandling or list[MessageHandling]) – selected message handling settings for this particular message
- class aitoolbox.torchtrain.train_loop.components.message_passing.MessageService[source]
Bases:
object
Message Passing Service
Primarily intended for passing the messages in the TrainLoop, especially for communication or data sharing between different callbacks.
- write_message(key, value, msg_handling_settings=MessageHandling.UNTIL_END_OF_EPOCH)[source]
Write a new message to the message service
- Parameters:
key (str) – message key
value – message content
msg_handling_settings (MessageHandling or list[MessageHandling]) –
setting how to handle the lifespan of the message. Can use one of the following message lifecycle handling settings which are variables imported from this script file and can be found defined at the beginning of the script:
KEEP_FOREVER
UNTIL_END_OF_EPOCH
UNTIL_READ
OVERWRITE
- Returns:
None