shenweichen / shenweichen/DeepCTR-Torch
How to export DeepCTR model to onnx ?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.5k
- Forks
- 733
- PR merge metrics
- No merged PRs in 30d
Description
Please refer to the FAQ in doc and search for the related issues before you ask the question.
Describe the question(问题描述)
I would like to export model to onnx format, so I can use it for example with Apache PredictionIO
Additional context
I tried with :
dummy_input = np.array([np.array([[0]]), np.array([[0]])])
pred_ans = model.predict(dummy_input, 100)
print(pred_ans)
torch.onnx.export(model, (dummy_input), "deepCTR.onnx")
predict works well, I am getting: [[0.0065056]]
but wwith onnx.export, I am getting error with this trace:
RuntimeError: Only tuples, lists and Variables supported as JIT inputs/outputs. Dictionaries and strings are also accepted but their usage is not recommended. But got unsupported type numpy.ndarray
Operating environment(运行环境):
- python version: 3.7
- torch version: 1.4.0
- deepctr-torch version: 0.1.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the FAQ and related issues first, then reproduce the failure from the provided model.predict and torch.onnx.export calls using the stated Python 3.7, PyTorch 1.4.0, and deepctr-torch 0.1.0 versions. Done means the DeepCTR model can be exported to ONNX for use with Apache PredictionIO, with the supported input form and limitations documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100