espnet3.contract.inference.resolve_inference_contract
Less than 1 minute
espnet3.contract.inference.resolve_inference_contract
espnet3.contract.inference.resolve_inference_contract(contract, root=None)
Load a serialized contract and its recipe registrations.
- Parameters:
- contract – An
InferenceContract, its mapping form, orNone. - root – A directory added to
sys.pathbefore loading a mapping, so itsimportsresolve.
- contract – An
- Returns: The contract, or
NonewhencontractisNone. - Raises:TypeError – If
contractis none of the accepted forms.
Examples
>>> resolve_inference_contract(None) is None
True
>>> contract = resolve_inference_contract(
... {
... "inputs": {"text": {"kind": "text"}},
... "outputs": {"text": {"kind": "text"}},
... }
... )
>>> [field.name for field in contract.outputs]
['text']