espnet3.contract.metrics.check_metric_declaration
Less than 1 minute
espnet3.contract.metrics.check_metric_declaration
espnet3.contract.metrics.check_metric_declaration(obj) → None
Raise TypeError unless every declared output has kind number.
Called in addition to the shared check_declaration (non-empty tuples, distinct names, …); this is the one rule specific to metrics.
- Parameters:obj – The class to check, or an instance whose own attributes (set in its
__init__) declare a contract its class does not. - Returns: None.
Examples
>>> class BadMetric:
... outputs = (Field("transcript", "text"),)
>>> check_metric_declaration(BadMetric)
Traceback (most recent call last):
TypeError: BadMetric.outputs field 'transcript' must have kind 'number', ...