flair.trainers.plugins.AnnealingPlugin#

class flair.trainers.plugins.AnnealingPlugin(base_path, min_learning_rate, anneal_factor, patience, initial_extra_patience, anneal_with_restarts)View on GitHub#

Bases: TrainerPlugin

Plugin for annealing logic in Flair.

__init__(base_path, min_learning_rate, anneal_factor, patience, initial_extra_patience, anneal_with_restarts)View on GitHub#

Initialize the base plugin.

Methods

__init__(base_path, min_learning_rate, ...)

Initialize the base plugin.

after_evaluation(current_model_is_best, ...)

Scheduler step of AnnealOnPlateau.

after_setup(train_with_dev, optimizer, **kw)

Initialize different schedulers, including anneal target for AnnealOnPlateau, batch_growth_annealing, loading schedulers.

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.

store_learning_rate()

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

store_learning_rate()View on GitHub#
after_setup(train_with_dev, optimizer, **kw)View on GitHub#

Initialize different schedulers, including anneal target for AnnealOnPlateau, batch_growth_annealing, loading schedulers.

after_evaluation(current_model_is_best, validation_scores, **kw)View on GitHub#

Scheduler step of AnnealOnPlateau.

get_state()View on GitHub#
Return type:

dict[str, Any]