def get_session_wrapper(
        model: ONNXModelHandler,
        metric: Metric,
        dataloader: "DataLoader",
        device: Device,
        execution_providers: list[str],
    ) -> tuple[OrtInferenceSession, dict[str, Any]]:
        """Get the session wrapper for the model."""
        # user.config.inference_settings > model.inference_settings > default inference_settings
        inference_settings = OnnxEvaluator.get_inference_settings(metric, model)
        session = model.prepare_session(
            inference_settings=inference_settings,
            device=device,
            execution_providers=execution_providers,
        )

        # prepare for io binding
        io_config = model.io_config
        io_bind = OnnxEvaluator.io_bind_enabled(metric, model.inference_settings)
        shared_kv_buffer = metric.user_config.shared_kv_buffer
        use_fp16 = any(v == "float16" for v in io_config["input_types"])
        input_feed = None
        if io_bind and shared_kv_buffer and use_fp16:
            input_feed = format_data(next(iter(dataloader))[0], io_config)

        # load constant inputs if any
        constant_inputs = None
        if model.constant_inputs_path:
            constant_inputs = format_data(load_weights(model.constant_inputs_path), io_config)

        # create session wrapper
        session_wrapper = OrtInferenceSession(
            session,
            io_bind=io_bind,
            device=device,
            shared_kv_buffer=shared_kv_buffer,
            use_fp16=use_fp16,
            input_feed=input_feed,
            constant_inputs=constant_inputs,
        )

        return session_wrapper, inference_settings
Get the session wrapper for the model.
olive/evaluator/olive_evaluator.py