mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-24 19:43:35 +00:00
Update nuphar notebook model download url (#7475)
This commit is contained in:
parent
196e6702ad
commit
8e21329206
1 changed files with 9 additions and 9 deletions
|
|
@ -532,8 +532,8 @@
|
|||
"source": [
|
||||
"# download BERT squad model\n",
|
||||
"cwd = os.getcwd()\n",
|
||||
"bert_model_url = 'https://onnxzoo.blob.core.windows.net/models/opset_10/bert_squad/download_sample_10.tar.gz'\n",
|
||||
"bert_model_local = os.path.join(cwd, 'download_sample_10.tar.gz')\n",
|
||||
"bert_model_url = 'https://github.com/onnx/models/raw/master/text/machine_comprehension/bert-squad/model/bertsquad-10.tar.gz'\n",
|
||||
"bert_model_local = os.path.join(cwd, 'bertsquad-10.tar.gz')\n",
|
||||
"if not os.path.exists(bert_model_local):\n",
|
||||
" urllib.request.urlretrieve(bert_model_url, bert_model_local)\n",
|
||||
"with tarfile.open(bert_model_local, 'r') as f:\n",
|
||||
|
|
@ -554,7 +554,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"bert_model_dir = os.path.join(cwd, 'download_sample_10')\n",
|
||||
"bert_model_dir = os.path.join(cwd, 'bertsquad-10')\n",
|
||||
"bert_model = os.path.join(bert_model_dir, 'bertsquad10.onnx')\n",
|
||||
"bert_model_with_shape_inference = os.path.join(bert_model_dir, 'bertsquad10_shaped.onnx')\n",
|
||||
"\n",
|
||||
|
|
@ -659,8 +659,8 @@
|
|||
"source": [
|
||||
"# download GPT-2 model\n",
|
||||
"cwd = os.getcwd()\n",
|
||||
"gpt2_model_url = 'https://onnxzoo.blob.core.windows.net/models/opset_10/GPT2/GPT-2.tar.gz'\n",
|
||||
"gpt2_model_local = os.path.join(cwd, 'GPT-2.tar.gz')\n",
|
||||
"gpt2_model_url = 'https://github.com/onnx/models/raw/master/text/machine_comprehension/gpt-2/model/gpt2-10.tar.gz'\n",
|
||||
"gpt2_model_local = os.path.join(cwd, 'gpt2-10.tar.gz')\n",
|
||||
"if not os.path.exists(gpt2_model_local):\n",
|
||||
" urllib.request.urlretrieve(gpt2_model_url, gpt2_model_local)\n",
|
||||
"with tarfile.open(gpt2_model_local, 'r') as f:\n",
|
||||
|
|
@ -721,11 +721,11 @@
|
|||
"sess_options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_ENABLE_ALL\n",
|
||||
"sess_baseline = onnxruntime.InferenceSession(gpt2_model, sess_options=sess_options, providers=['CPUExecutionProvider'])\n",
|
||||
"\n",
|
||||
"# load test data, note the tensor proto name in data does not match model, so override it in feed\n",
|
||||
"# load test data\n",
|
||||
"input_name = [i.name for i in sess_baseline.get_inputs()][0] # This model only has one input\n",
|
||||
"test_data_dir = os.path.join(gpt2_model_dir, 'test_data_set_0')\n",
|
||||
"tp = onnx.load_tensor(os.path.join(test_data_dir, 'input_0.pb'))\n",
|
||||
"gpt2_feed = {input_name:numpy_helper.to_array(tp).reshape(1,-1)} # the test data missed batch dimension\n",
|
||||
"gpt2_feed = {input_name:numpy_helper.to_array(tp)}\n",
|
||||
"gpt2_output_baseline = sess_baseline.run([], gpt2_feed)\n",
|
||||
"\n",
|
||||
"gpt2_repeats = 100\n",
|
||||
|
|
@ -765,8 +765,8 @@
|
|||
"source": [
|
||||
"# download BiDAF model\n",
|
||||
"cwd = os.getcwd()\n",
|
||||
"bidaf_url = 'https://onnxzoo.blob.core.windows.net/models/opset_9/bidaf/bidaf.tar.gz'\n",
|
||||
"bidaf_local = os.path.join(cwd, 'bidaf.tar.gz')\n",
|
||||
"bidaf_url = 'https://github.com/onnx/models/raw/master/text/machine_comprehension/bidirectional_attention_flow/model/bidaf-9.tar.gz'\n",
|
||||
"bidaf_local = os.path.join(cwd, 'bidaf-9.tar.gz')\n",
|
||||
"if not os.path.exists(bidaf_local):\n",
|
||||
" urllib.request.urlretrieve(bidaf_url, bidaf_local)\n",
|
||||
"with tarfile.open(bidaf_local, 'r') as f:\n",
|
||||
|
|
|
|||
Loading…
Reference in a new issue