Typically you might create a configuration file specifying the model and
training parameters and then use
rather than instantiating a
TrainerBase(serialization_dir: str, cuda_device: Union[int, List] = -1)¶
The base class for an AllenNLP trainer. It can do pretty much anything you want. Your subclass should implement
trainand also probably
from_params(params: allennlp.common.params.Params, serialization_dir: str, recover: bool = False)¶
This is the automatic implementation of from_params. Any class that subclasses FromParams (or Registrable, which itself subclasses FromParams) gets this implementation for free. If you want your class to be instantiated from params in the “obvious” way – pop off parameters and hand them to your constructor with the same names – this provides that functionality.
If you need more complex logic in your from from_params method, you’ll have to implement your own method that overrides this one.
train() → Dict[str, Any]¶
Train a model and return the results.