onnx / onnx/models

How could I convert output tensor to text generation?

Open
#451 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Jupyter Notebook
Stars
9.8k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Ask a Question

Question

text/machine_comprehension/gpt-2/dependencies/GPT2-export.py

I succeeded in extracting the output tensor value for the example input text using the above example. Furthermore, I need advice on how to run text generation using output tensor values. Is there a code or a link I can refer to? (Pytorch or python code..)

The code I tried is as follows. But it didn't work.
image

'ort_outputs_exmodel' above image is same as 'res' link below https://github.com/onnx/models/blob/ad5c181f1646225f034fba1862233ecb4c262e04/text/machine_comprehension/gpt-2/dependencies/GPT2-export.py#L110

My final goal of the project is to load the onnx model using onnx runtime's C/C++ API and write the C/C++ code to generate text using output tensor values.

I'll be waiting for your reply. (looking forward to...)
Thank u very much.

Further information

Relevant Area (e.g. model usage, backend, best practices, pre-/post- processing, converters):

Is this issue related to a specific model?
Model name (e.g. mnist): gpt-2
Model opset (e.g. 7):

Notes

Any additional information, code snippets.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with text/machine_comprehension/gpt-2/dependencies/GPT2-export.py, especially the output referenced at line 110, and review the reported output tensor and attempted code. Determine whether the repository can provide a documented path or example for turning GPT-2 output into generated text through the C/C++ API. Done means the expected tensor-to-text workflow and a working reference are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp, python, pytorch
Domain
machine-learning
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.