def train_model_from_file(
    parameter_filename: Union[str, PathLike],
    serialization_dir: Union[str, PathLike],
    overrides: Union[str, Dict[str, Any]] = "",
    recover: bool = False,
    force: bool = False,
    node_rank: int = 0,
    include_package: List[str] = None,
    dry_run: bool = False,
    file_friendly_logging: bool = False,
    return_model: Optional[bool] = None,
) -> Optional[Model]:
    """
    A wrapper around [`train_model`](#train_model) which loads the params from a file.

    # Parameters

    parameter_filename : `str`
        A json parameter file specifying an AllenNLP experiment.
    serialization_dir : `str`
        The directory in which to save results and logs. We just pass this along to
        [`train_model`](#train_model).
    overrides : `Union[str, Dict[str, Any]]`, optional (default = `""`)
        A JSON string or a dict that we will use to override values in the input parameter file.
    recover : `bool`, optional (default=`False`)
        If `True`, we will try to recover a training run from an existing serialization
        directory.  This is only intended for use when something actually crashed during the middle
        of a run.  For continuing training a model on new data, see `Model.from_archive`.
    force : `bool`, optional (default=`False`)
        If `True`, we will overwrite the serialization directory if it already exists.
    node_rank : `int`, optional
        Rank of the current node in distributed training
    include_package : `str`, optional
        In distributed mode, extra packages mentioned will be imported in trainer workers.
    dry_run : `bool`, optional (default=`False`)
        Do not train a model, but create a vocabulary, show dataset statistics and other training
        information.
    file_friendly_logging : `bool`, optional (default=`False`)
        If `True`, we add newlines to tqdm output, even on an interactive terminal, and we slow
        down tqdm's output to only once every 10 seconds.
    return_model : `Optional[bool]`, optional (default = `None`)
        Whether or not to return the final model. If not specified, this defaults to `False` for
        distributed training and `True` otherwise.

    # Returns

    best_model : `Optional[str]`
        The path to the archived model with the best weights or `None` if in dry run.
    best_model : `Optional[Model]`
        The model with the best epoch weights or `None`, depending on the value of `return_model` and `dry_run`.
    """
    # Load the experiment config from a file and pass it to `train_model`.
    params = Params.from_file(parameter_filename, overrides)
    return train_model(
        params=params,
        serialization_dir=serialization_dir,
        recover=recover,
        force=force,
        node_rank=node_rank,
        include_package=include_package,
        dry_run=dry_run,
        file_friendly_logging=file_friendly_logging,
        return_model=return_model,
    )
A wrapper around [`train_model`](#train_model) which loads the params from a file.

# Parameters

parameter_filename : `str`
A json parameter file specifying an AllenNLP experiment.
serialization_dir : `str`
The directory in which to save results and logs. We just pass this along to
[`train_model`](#train_model).
overrides : `Union[str, Dict[str, Any]]`, optional (default = `""`)
A JSON string or a dict that we will use to override values in the input parameter file.
recover : `bool`, optional (default=`False`)
If `True`, we will try to recover a training run from an existing serialization
directory.  This is only intended for use when something actually crashed during the middle
of a run.  For continuing training a model on new data, see `Model.from_archive`.
force : `bool`, optional (default=`False`)
If `True`, we will overwrite the serialization directory if it already exists.
node_rank : `int`, optional
Rank of the current node in distributed training
include_package : `str`, optional
In distributed mode, extra packages mentioned will be imported in trainer workers.
dry_run : `bool`, optional (default=`False`)
Do not train a model, but create a vocabulary, show dataset statistics and other training
information.
file_friendly_logging : `bool`, optional (default=`False`)
If `True`, we add newlines to tqdm output, even on an interactive terminal, and we slow
down tqdm's output to only once every 10 seconds.
return_model : `Optional[bool]`, optional (default = `None`)
Whether or not to return the final model. If not specified, this defaults to `False` for
distributed training and `True` otherwise.

# Returns

best_model : `Optional[str]`
The path to the archived model with the best weights or `None` if in dry run.
best_model : `Optional[Model]`
The model with the best epoch weights or `None`, depending on the value of `return_model` and `dry_run`.
allennlp/commands/train.py