def enable_past_present_share_buffer(self, ort_inputs: dict, past_seq_len: int, max_seq_len: int):
        """Enable past-present share buffer for GQA. For ONNX model + FP16 + GQA only."""
        for k, v in ort_inputs.items():
            # Allocate new buffers with max_seq_len for GQA
            if "past_key_values" in k:
                # Copy v (BxSxPxH) into new_v (BxSxMxH)
                num_heads, _, head_size = v.shape
                new_v = torch.zeros((num_heads, max_seq_len, head_size), dtype=v.dtype)
                new_v[:num_heads, :past_seq_len, :head_size] = v
                ort_inputs[k] = new_v
        return ort_inputs
Enable past-present share buffer for GQA. For ONNX model + FP16 + GQA only.
olive/data/component/dataset.py