INNER CODE UNIT · Python
past_key_values
Ki6an/fastT5 · fastT5/onnx_exporter.py:127
past_key_values = (t5_block,) * model_config.num_decoder_layers
flat_past_key_values = functools.reduce(operator.iconcat, past_key_values, [])
decoder_all_inputs = tuple(
[input_ids_dec, attention_mask_dec, enc_out] + flat_past_key_values
)
# for progress bars
bar = Bar("Exporting to onnx...", max=3)
import warnings
# ignores all the warnings during conversion
warnings.filterwarnings("ignore")
# Exports to ONNX
with torch.no_grad():