class str, model: allennlp.models.model.Model)[source]


classmethod from_params(params: allennlp.common.params.Params, serialization_dir: str, recover: bool = False)[source]

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][source]

Train a model and return the results.