Skip to content

Calling CreateSessionFromArray on our model triggers an Exception #28267

Description

@zkrueger-iis

Describe the issue

While updating onnxruntime from 1.5.1 to the latest version 1.24.4, our model triggered following exception when calling CreateSessionFromArray() .
Exception during initialization: onnxruntime\core\optimizer\initializer.cc:77 onnxruntime::Initializer::Initializer !model_path.empty() was false. model_path must not be empty. Ensure that a path is provided when the model is created or loaded.

From debugging this issue, we noticed that although the tensor_proto from our model evaluates to true at line 62 in onnxruntime/core/optimizer/initializer.cc it does not evaluate to true at line 64.
Removing ORT_ENFORCE at line 76 / 77 in onnxruntime\core\optimizer\initializer.cc solves this issue so that the session can be created again and the model performs as expected.
Also, our model loads without issues as a .onnx model via CreateSession() with the latest onnxruntime.

To reproduce

Load the .onnx model that triggers this exception into a buffer and call CreateSessionFromArray() on it.
This issue could not be reproduced with some of the models from the onnxruntime model zoo.

Urgency

No response

Platform

Windows

OS Version

11 Enterprise

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.24.4

ONNX Runtime API

C

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleissues that have not been addressed in a while; categorized by a bot

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions