mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-15 18:23:41 +00:00
* initial setup and rename "how to" to "setup" * move API to main nav * move api to main nav * add get starated, rework nav order * rename to install move mds out of install section * update api nav and home page * add install docs and python qs updates * python get started work * remove c and obj c for now * move java, python, and obj-c docs under api folder * move java api html to iframe (ugh) * remove api docs w/o details, move api text getstar * remove api docs wo detail updates get started * remvoe iframes * move eco system to main nav * fix api buttons * added more examples moved intro to ORT * fix links * fix get started titles * fix get started titles * fix more links * fix more links * more link fixes * fix nav remove inferencing and training subnav * fix top nav remove inference and training nav * fix title * fix tutorials nav hierarchy * fix python api button * add tenorflow keras example * fix quickstart toc * add imports fix spacing * fix links * update nav and python get started page * move ort training example, add coming soon for iot * update C# get started * fix spacing on quantization * Add some js get started content * fix formatting * fix typo * removed onnx-pytorch and onnx-tf * updated pip install torch and added links iot page * added pytorch tutorial heirarchy * updated web to docs soon added release blog link * add web link
72 lines
No EOL
2.5 KiB
Text
72 lines
No EOL
2.5 KiB
Text
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"%matplotlib inline"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"\n# Metadata\n\nONNX format contains metadata related to how the\nmodel was produced. It is useful when the model\nis deployed to production to keep track of which\ninstance was used at a specific time.\nLet's see how to do that with a simple \nlogistic regression model trained with\n*scikit-learn* and converted with *sklearn-onnx*.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"from onnxruntime.datasets import get_example\nexample = get_example(\"logreg_iris.onnx\")\n\nimport onnx\nmodel = onnx.load(example)\n\nprint(\"doc_string={}\".format(model.doc_string))\nprint(\"domain={}\".format(model.domain))\nprint(\"ir_version={}\".format(model.ir_version))\nprint(\"metadata_props={}\".format(model.metadata_props))\nprint(\"model_version={}\".format(model.model_version))\nprint(\"producer_name={}\".format(model.producer_name))\nprint(\"producer_version={}\".format(model.producer_version))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"With *ONNX Runtime*:\n\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"from onnxruntime import InferenceSession\nsess = InferenceSession(example)\nmeta = sess.get_modelmeta()\n\nprint(\"custom_metadata_map={}\".format(meta.custom_metadata_map))\nprint(\"description={}\".format(meta.description))\nprint(\"domain={}\".format(meta.domain, meta.domain))\nprint(\"graph_name={}\".format(meta.graph_name))\nprint(\"producer_name={}\".format(meta.producer_name))\nprint(\"version={}\".format(meta.version))"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.7.0"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 0
|
|
} |