Giter Club home page Giter Club logo

Comments (3)

tianleiwu avatar tianleiwu commented on July 23, 2024

You can add "hidden_states" to model output, and export the model to onnx so that onnx model also has the output.

For example, in huggingface transformers, you can pass pass output_hidden_states=True so that the hidden states is output.
https://github.com/huggingface/transformers/blob/37bba2a32d2742a10216ffd925bb8f145a732ce1/src/transformers/models/megatron_bert/modeling_megatron_bert.py#L527

from onnxruntime.

dogdogpp avatar dogdogpp commented on July 23, 2024

from onnxruntime.

dogdogpp avatar dogdogpp commented on July 23, 2024

Yes. However, the transformer only has a python version, and what I need to achieve is to get this data in the C++ version, and I can't use the transformer. Is there a way to make it happen, thanks!

您可以在模型输出中添加“hidden_states”,并将模型导出到 onnx,以便 onnx 模型也具有输出。

例如,在 huggingface transformers 中,您可以传递 pass,以便输出隐藏状态。 https://github.com/huggingface/transformers/blob/37bba2a32d2742a10216ffd925bb8f145a732ce1/src/transformers/models/megatron_bert/modeling_megatron_bert.py#L527`output_hidden_states=True`

from onnxruntime.

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.