espnet3.contract.inference.prepare_inference_inputs
Less than 1 minute
espnet3.contract.inference.prepare_inference_inputs
espnet3.contract.inference.prepare_inference_inputs(dataset, idx, contract, model)
Return prepared and original sample mappings for one runner call.
- Parameters:
- dataset – The dataset the runner reads from.
- idx – One index or a list of indices.
- contract – The inference contract.
- model – The backend, for what it knows (its
sample_rate).
- Returns: the prepared samples and the originals.
- Return type: Two dicts keyed by dataset index
Examples
>>> contract = load_inference_contract(
... {
... "inputs": {"text": {"kind": "text"}},
... "outputs": {"text": {"kind": "text"}},
... }
... )
>>> prepare_inference_inputs([{"text": "hi"}], 0, contract, None)
({0: {'text': 'hi'}}, {0: {'text': 'hi'}})