Giter Site home page Giter Site logo

Comments (3)

SunDoge avatar SunDoge commented on August 24, 2024 1

I see. But by default

If a session is created using an input byte array containing the ORT format model data, by default we will copy the model bytes at the time of session creation to ensure the model bytes buffer is valid.

The api with_model_from_memory should be consistent with with_model_from_file. And ort::session::InMemorySession should be created with another api, e.g. with_model_from_memory_directly.

from ort.

SunDoge avatar SunDoge commented on August 24, 2024

And the C API does not mention that we have to keep model_bytes alive while using Session. Session should parse the model_bytes and keep the parsed params and graph in memory so it can outlive the model_bytes.

from ort.

decahedron1 avatar decahedron1 commented on August 24, 2024

Session should parse the model_bytes and keep the parsed params and graph in memory so it can outlive the model_bytes.

Not always, For .ort models, we enable session.use_ort_model_bytes_directly:

You may also enable the option to use the model bytes directly by setting the SessionOptions config entry session.use_ort_model_bytes_directly to 1. This may reduce the peak memory usage of ONNX Runtime Mobile, but you will need to guarantee that the model bytes are valid throughout the lifespan of the ORT session.

https://onnxruntime.ai/docs/performance/model-optimizations/ort-format-models.html

from ort.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.