flair.trainers.plugins.BasePlugin#

class flair.trainers.plugins.BasePluginView on GitHub#

Bases: object

Base class for all plugins.

__init__()View on GitHub#

Initialize the base plugin.

Methods

__init__()

Initialize the base plugin.

attach_to(pluggable)

Attach this plugin to a Pluggable.

detach()

Detach a plugin from the Pluggable it is attached to.

get_state()

hook([first_arg])

Convience function for BasePlugin.mark_func_as_hook).

mark_func_as_hook(func, *events)

Mark method as a hook triggered by the Pluggable.

Attributes

attach_to_all_processes

If set, the plugin will be attached to all processes when distributed, not just the main process.

pluggable

attach_to(pluggable)View on GitHub#

Attach this plugin to a Pluggable.

detach()View on GitHub#

Detach a plugin from the Pluggable it is attached to.

classmethod mark_func_as_hook(func, *events)View on GitHub#

Mark method as a hook triggered by the Pluggable.

Return type:

Callable

classmethod hook(first_arg=None, *other_args)View on GitHub#

Convience function for BasePlugin.mark_func_as_hook).

Enables using the @BasePlugin.hook syntax.

Can also be used as: @BasePlugin.hook(“some_event”, “another_event”)

Return type:

Callable

property pluggable: Pluggable | None#
property attach_to_all_processes: bool#

If set, the plugin will be attached to all processes when distributed, not just the main process.

get_state()View on GitHub#
Return type:

dict[str, Any]