flair.trainers.LanguageModelTrainer#
- class flair.trainers.LanguageModelTrainer(model, corpus, optimizer=<class 'torch.optim.sgd.SGD'>, test_mode=False, epoch=0, split=0, loss=10000, optimizer_state=None, scaler_state=None)View on GitHub#
Bases:
object
- __init__(model, corpus, optimizer=<class 'torch.optim.sgd.SGD'>, test_mode=False, epoch=0, split=0, loss=10000, optimizer_state=None, scaler_state=None)View on GitHub#
Methods
__init__
(model, corpus[, optimizer, ...])evaluate
(data_source, eval_batch_size, ...)load_checkpoint
(checkpoint_file, corpus[, ...])train
(base_path, sequence_length[, ...])- train(base_path, sequence_length, learning_rate=20, mini_batch_size=100, anneal_factor=0.25, patience=10, clip=0.25, max_epochs=1000, checkpoint=False, grow_to_sequence_length=0, num_workers=2, use_amp=False, **kwargs)View on GitHub#
- evaluate(data_source, eval_batch_size, sequence_length)View on GitHub#
- static load_checkpoint(checkpoint_file, corpus, optimizer=<class 'torch.optim.sgd.SGD'>)View on GitHub#