flair.trainers.plugins.LossFilePlugin#

class flair.trainers.plugins.LossFilePlugin(base_path, epoch, metrics_to_collect=None)View on GitHub#

Bases: TrainerPlugin

Plugin that manages the loss.tsv file output.

__init__(base_path, epoch, metrics_to_collect=None)View on GitHub#

Initialize the base plugin.

Methods

__init__(base_path, epoch[, metrics_to_collect])

Initialize the base plugin.

after_evaluation(epoch, **kw)

This prints all relevant metrics.

attach_to(pluggable)

Attach this plugin to a Pluggable.

before_training_epoch(epoch, **kw)

Get the current epoch for loss file logging.

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.

metric_recorded(record)

Add the metric of a record to the current row.

Attributes

attach_to_all_processes

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

corpus

model

pluggable

trainer

get_state()View on GitHub#
Return type:

dict[str, Any]

before_training_epoch(epoch, **kw)View on GitHub#

Get the current epoch for loss file logging.

metric_recorded(record)View on GitHub#

Add the metric of a record to the current row.

after_evaluation(epoch, **kw)View on GitHub#

This prints all relevant metrics.

property attach_to_all_processes: bool#

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