composer.datasets.evaluator#
Specifies an instance of an Evaluator, which wraps a dataloader to include metrics that apply to
a specific dataset.
Hparams
These classes are used with yahp for YAML-based configuration.
Params for the |
- class composer.datasets.evaluator.EvaluatorHparams(label, eval_dataset, metric_names=None)[source]#
Bases:
yahp.hparams.HparamsParams for the
Evaluator.Also see the documentation for the
Evaluator.- Parameters
label (str) โ Name of the Evaluator. Used for logging/reporting metrics.
eval_dataset (DatasetHparams) โ Evaluation dataset.
metrics (list, optional) โ List of strings of names of the metrics for the evaluator. Can be a
torchmetrics.Metricname or the class name of a metric returned bymetrics()IfNone, uses all metrics in the model. Default:None.
- initialize_object(model, batch_size, dataloader_hparams)[source]#
Initialize an
EvaluatorIf the Evaluator
metric_namesis empty or None is provided, the function returns a copy of all the modelโs default evaluation metrics.- Parameters
model (ComposerModel) โ The model, which is used to retrieve metric names.
batch_size (int) โ The device batch size to use for the evaluation dataset.
dataloader_hparams (DataLoaderHparams) โ The hparams to use to construct a dataloader for the evaluation dataset.
- Returns
Evaluator โ The evaluator.