diff --git a/examples/verifiable_mnist/verifiable_mnist.ipynb b/examples/verifiable_mnist/verifiable_mnist.ipynb index 862888a..672123a 100644 --- a/examples/verifiable_mnist/verifiable_mnist.ipynb +++ b/examples/verifiable_mnist/verifiable_mnist.ipynb @@ -1799,11 +1799,11 @@ { "data": { "text/html": [ - "
18:27:34.088 | INFO | Created flow run 'sturdy-tuatara' for flow 'Execution: Prediction with ONNX'\n", + "13:07:59.401 | INFO | Created flow run 'tidy-pudu' for flow 'Execution: Prediction with ONNX'\n", "\n" ], "text/plain": [ - "18:27:34.088 | \u001b[36mINFO\u001b[0m | Created flow run\u001b[35m 'sturdy-tuatara'\u001b[0m for flow\u001b[1;35m 'Execution: Prediction with ONNX'\u001b[0m\n" + "13:07:59.401 | \u001b[36mINFO\u001b[0m | Created flow run\u001b[35m 'tidy-pudu'\u001b[0m for flow\u001b[1;35m 'Execution: Prediction with ONNX'\u001b[0m\n" ] }, "metadata": {}, @@ -1812,11 +1812,11 @@ { "data": { "text/html": [ - "18:27:34.089 | INFO | Action run 'sturdy-tuatara' - View at https://actions-server-raphael-doukhan-dblzzhtf5q-ew.a.run.app/flow-runs/flow-run/7a459701-cad9-4ba8-bc87-99d9487de28c\n", + "13:07:59.402 | INFO | Action run 'tidy-pudu' - View at https://actions-server-raphael-doukhan-dblzzhtf5q-ew.a.run.app/flow-runs/flow-run/5a785ee4-7193-4d61-94c0-062a5730bfd0\n", "\n" ], "text/plain": [ - "18:27:34.089 | \u001b[36mINFO\u001b[0m | Action run 'sturdy-tuatara' - View at \u001b[94mhttps://actions-server-raphael-doukhan-dblzzhtf5q-ew.a.run.app/flow-runs/flow-run/7a459701-cad9-4ba8-bc87-99d9487de28c\u001b[0m\n" + "13:07:59.402 | \u001b[36mINFO\u001b[0m | Action run 'tidy-pudu' - View at \u001b[94mhttps://actions-server-raphael-doukhan-dblzzhtf5q-ew.a.run.app/flow-runs/flow-run/5a785ee4-7193-4d61-94c0-062a5730bfd0\u001b[0m\n" ] }, "metadata": {}, @@ -1825,11 +1825,11 @@ { "data": { "text/html": [ - "18:27:34.418 | INFO | Action run 'sturdy-tuatara' - Created task run 'Preprocess Image-0' for task 'Preprocess Image'\n", + "13:07:59.632 | INFO | Action run 'tidy-pudu' - Created task run 'Preprocess Image-0' for task 'Preprocess Image'\n", "
\n" ], "text/plain": [ - "18:27:34.418 | \u001b[36mINFO\u001b[0m | Action run 'sturdy-tuatara' - Created task run 'Preprocess Image-0' for task 'Preprocess Image'\n" + "13:07:59.632 | \u001b[36mINFO\u001b[0m | Action run 'tidy-pudu' - Created task run 'Preprocess Image-0' for task 'Preprocess Image'\n" ] }, "metadata": {}, @@ -1838,11 +1838,11 @@ { "data": { "text/html": [ - "18:27:34.421 | INFO | Action run 'sturdy-tuatara' - Executing 'Preprocess Image-0' immediately...\n", + "13:07:59.633 | INFO | Action run 'tidy-pudu' - Executing 'Preprocess Image-0' immediately...\n", "
\n" ], "text/plain": [ - "18:27:34.421 | \u001b[36mINFO\u001b[0m | Action run 'sturdy-tuatara' - Executing 'Preprocess Image-0' immediately...\n" + "13:07:59.633 | \u001b[36mINFO\u001b[0m | Action run 'tidy-pudu' - Executing 'Preprocess Image-0' immediately...\n" ] }, "metadata": {}, @@ -1851,11 +1851,11 @@ { "data": { "text/html": [ - "18:27:34.797 | INFO | Task run 'Preprocess Image-0' - Finished in state Completed()\n", + "13:07:59.886 | INFO | Task run 'Preprocess Image-0' - Finished in state Completed()\n", "\n" ], "text/plain": [ - "18:27:34.797 | \u001b[36mINFO\u001b[0m | Task run 'Preprocess Image-0' - Finished in state \u001b[32mCompleted\u001b[0m()\n" + "13:07:59.886 | \u001b[36mINFO\u001b[0m | Task run 'Preprocess Image-0' - Finished in state \u001b[32mCompleted\u001b[0m()\n" ] }, "metadata": {}, @@ -1864,11 +1864,11 @@ { "data": { "text/html": [ - "18:27:34.917 | INFO | Action run 'sturdy-tuatara' - Created task run 'Prediction with ONNX-0' for task 'Prediction with ONNX'\n", + "13:07:59.972 | INFO | Action run 'tidy-pudu' - Created task run 'Prediction with ONNX-0' for task 'Prediction with ONNX'\n", "
\n" ], "text/plain": [ - "18:27:34.917 | \u001b[36mINFO\u001b[0m | Action run 'sturdy-tuatara' - Created task run 'Prediction with ONNX-0' for task 'Prediction with ONNX'\n" + "13:07:59.972 | \u001b[36mINFO\u001b[0m | Action run 'tidy-pudu' - Created task run 'Prediction with ONNX-0' for task 'Prediction with ONNX'\n" ] }, "metadata": {}, @@ -1877,11 +1877,11 @@ { "data": { "text/html": [ - "18:27:34.920 | INFO | Action run 'sturdy-tuatara' - Executing 'Prediction with ONNX-0' immediately...\n", + "13:07:59.974 | INFO | Action run 'tidy-pudu' - Executing 'Prediction with ONNX-0' immediately...\n", "
\n" ], "text/plain": [ - "18:27:34.920 | \u001b[36mINFO\u001b[0m | Action run 'sturdy-tuatara' - Executing 'Prediction with ONNX-0' immediately...\n" + "13:07:59.974 | \u001b[36mINFO\u001b[0m | Action run 'tidy-pudu' - Executing 'Prediction with ONNX-0' immediately...\n" ] }, "metadata": {}, @@ -1890,11 +1890,11 @@ { "data": { "text/html": [ - "18:27:35.293 | INFO | Task run 'Prediction with ONNX-0' - Finished in state Completed()\n", + "13:08:00.220 | INFO | Task run 'Prediction with ONNX-0' - Finished in state Completed()\n", "\n" ], "text/plain": [ - "18:27:35.293 | \u001b[36mINFO\u001b[0m | Task run 'Prediction with ONNX-0' - Finished in state \u001b[32mCompleted\u001b[0m()\n" + "13:08:00.220 | \u001b[36mINFO\u001b[0m | Task run 'Prediction with ONNX-0' - Finished in state \u001b[32mCompleted\u001b[0m()\n" ] }, "metadata": {}, @@ -1903,11 +1903,11 @@ { "data": { "text/html": [ - "18:27:35.296 | INFO | Action run 'sturdy-tuatara' - Predicted Digit: 0\n", + "13:08:00.223 | INFO | Action run 'tidy-pudu' - Predicted Digit: 0\n", "
\n" ], "text/plain": [ - "18:27:35.296 | \u001b[36mINFO\u001b[0m | Action run 'sturdy-tuatara' - Predicted Digit: 0\n" + "13:08:00.223 | \u001b[36mINFO\u001b[0m | Action run 'tidy-pudu' - Predicted Digit: 0\n" ] }, "metadata": {}, @@ -1916,11 +1916,11 @@ { "data": { "text/html": [ - "18:27:35.423 | INFO | Action run 'sturdy-tuatara' - Finished in state Completed()\n", + "13:08:00.314 | INFO | Action run 'tidy-pudu' - Finished in state Completed()\n", "\n" ], "text/plain": [ - "18:27:35.423 | \u001b[36mINFO\u001b[0m | Action run 'sturdy-tuatara' - Finished in state \u001b[32mCompleted\u001b[0m()\n" + "13:08:00.314 | \u001b[36mINFO\u001b[0m | Action run 'tidy-pudu' - Finished in state \u001b[32mCompleted\u001b[0m()\n" ] }, "metadata": {}, @@ -1995,7 +1995,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -2006,7 +2006,7 @@ "\n", " `@task(name='my_unique_name', ...)`\n", " warnings.warn(\n", - "/Users/raphaeldoukhan/Library/Caches/pypoetry/virtualenvs/giza-actions-mYf3m_Lk-py3.11/lib/python3.11/site-packages/prefect/flows.py:338: UserWarning: A flow named 'Execution: Prediction with Cairo' and defined at '/Users/raphaeldoukhan/Desktop/Orion-Giza/Tools/actions-sdk/giza_actions/action.py:16' conflicts with another flow. Consider specifying a unique `name` parameter in the flow definition:\n", + "/Users/raphaeldoukhan/Library/Caches/pypoetry/virtualenvs/giza-actions-mYf3m_Lk-py3.11/lib/python3.11/site-packages/prefect/flows.py:338: UserWarning: A flow named 'Execution: Prediction with Cairo' and defined at '/Users/raphaeldoukhan/Desktop/Orion-Giza/Tools/actions-sdk/giza_actions/action.py:23' conflicts with another flow. Consider specifying a unique `name` parameter in the flow definition:\n", "\n", " `@flow(name='my_unique_name', ...)`\n", " warnings.warn(\n" @@ -2015,11 +2015,11 @@ { "data": { "text/html": [ - "18:27:39.837 | INFO | Created flow run 'blond-mouse' for flow 'Execution: Prediction with Cairo'\n", + "13:11:42.216 | INFO | Created flow run 'gleaming-falcon' for flow 'Execution: Prediction with Cairo'\n", "\n" ], "text/plain": [ - "18:27:39.837 | \u001b[36mINFO\u001b[0m | Created flow run\u001b[35m 'blond-mouse'\u001b[0m for flow\u001b[1;35m 'Execution: Prediction with Cairo'\u001b[0m\n" + "13:11:42.216 | \u001b[36mINFO\u001b[0m | Created flow run\u001b[35m 'gleaming-falcon'\u001b[0m for flow\u001b[1;35m 'Execution: Prediction with Cairo'\u001b[0m\n" ] }, "metadata": {}, @@ -2028,11 +2028,11 @@ { "data": { "text/html": [ - "18:27:39.838 | INFO | Action run 'blond-mouse' - View at https://actions-server-raphael-doukhan-dblzzhtf5q-ew.a.run.app/flow-runs/flow-run/db31f3a9-87d8-4e5b-8bec-4d25513c5235\n", + "13:11:42.218 | INFO | Action run 'gleaming-falcon' - View at https://actions-server-raphael-doukhan-dblzzhtf5q-ew.a.run.app/flow-runs/flow-run/e19704cf-8655-41b5-9ba5-357c7bfe53fa\n", "\n" ], "text/plain": [ - "18:27:39.838 | \u001b[36mINFO\u001b[0m | Action run 'blond-mouse' - View at \u001b[94mhttps://actions-server-raphael-doukhan-dblzzhtf5q-ew.a.run.app/flow-runs/flow-run/db31f3a9-87d8-4e5b-8bec-4d25513c5235\u001b[0m\n" + "13:11:42.218 | \u001b[36mINFO\u001b[0m | Action run 'gleaming-falcon' - View at \u001b[94mhttps://actions-server-raphael-doukhan-dblzzhtf5q-ew.a.run.app/flow-runs/flow-run/e19704cf-8655-41b5-9ba5-357c7bfe53fa\u001b[0m\n" ] }, "metadata": {}, @@ -2041,11 +2041,11 @@ { "data": { "text/html": [ - "18:27:40.177 | INFO | Action run 'blond-mouse' - Created task run 'Preprocess Image-0' for task 'Preprocess Image'\n", + "13:11:42.436 | INFO | Action run 'gleaming-falcon' - Created task run 'Preprocess Image-0' for task 'Preprocess Image'\n", "
\n" ], "text/plain": [ - "18:27:40.177 | \u001b[36mINFO\u001b[0m | Action run 'blond-mouse' - Created task run 'Preprocess Image-0' for task 'Preprocess Image'\n" + "13:11:42.436 | \u001b[36mINFO\u001b[0m | Action run 'gleaming-falcon' - Created task run 'Preprocess Image-0' for task 'Preprocess Image'\n" ] }, "metadata": {}, @@ -2054,11 +2054,11 @@ { "data": { "text/html": [ - "18:27:40.180 | INFO | Action run 'blond-mouse' - Executing 'Preprocess Image-0' immediately...\n", + "13:11:42.438 | INFO | Action run 'gleaming-falcon' - Executing 'Preprocess Image-0' immediately...\n", "
\n" ], "text/plain": [ - "18:27:40.180 | \u001b[36mINFO\u001b[0m | Action run 'blond-mouse' - Executing 'Preprocess Image-0' immediately...\n" + "13:11:42.438 | \u001b[36mINFO\u001b[0m | Action run 'gleaming-falcon' - Executing 'Preprocess Image-0' immediately...\n" ] }, "metadata": {}, @@ -2067,11 +2067,11 @@ { "data": { "text/html": [ - "18:27:40.554 | INFO | Task run 'Preprocess Image-0' - Finished in state Completed()\n", + "13:11:42.748 | INFO | Task run 'Preprocess Image-0' - Finished in state Completed()\n", "\n" ], "text/plain": [ - "18:27:40.554 | \u001b[36mINFO\u001b[0m | Task run 'Preprocess Image-0' - Finished in state \u001b[32mCompleted\u001b[0m()\n" + "13:11:42.748 | \u001b[36mINFO\u001b[0m | Task run 'Preprocess Image-0' - Finished in state \u001b[32mCompleted\u001b[0m()\n" ] }, "metadata": {}, @@ -2080,11 +2080,11 @@ { "data": { "text/html": [ - "18:27:40.675 | INFO | Action run 'blond-mouse' - Created task run 'Prediction with Cairo-0' for task 'Prediction with Cairo'\n", + "13:11:42.826 | INFO | Action run 'gleaming-falcon' - Created task run 'Prediction with Cairo-0' for task 'Prediction with Cairo'\n", "
\n" ], "text/plain": [ - "18:27:40.675 | \u001b[36mINFO\u001b[0m | Action run 'blond-mouse' - Created task run 'Prediction with Cairo-0' for task 'Prediction with Cairo'\n" + "13:11:42.826 | \u001b[36mINFO\u001b[0m | Action run 'gleaming-falcon' - Created task run 'Prediction with Cairo-0' for task 'Prediction with Cairo'\n" ] }, "metadata": {}, @@ -2093,11 +2093,11 @@ { "data": { "text/html": [ - "18:27:40.676 | INFO | Action run 'blond-mouse' - Executing 'Prediction with Cairo-0' immediately...\n", + "13:11:42.827 | INFO | Action run 'gleaming-falcon' - Executing 'Prediction with Cairo-0' immediately...\n", "
\n" ], "text/plain": [ - "18:27:40.676 | \u001b[36mINFO\u001b[0m | Action run 'blond-mouse' - Executing 'Prediction with Cairo-0' immediately...\n" + "13:11:42.827 | \u001b[36mINFO\u001b[0m | Action run 'gleaming-falcon' - Executing 'Prediction with Cairo-0' immediately...\n" ] }, "metadata": {}, @@ -2114,11 +2114,11 @@ { "data": { "text/html": [ - "18:27:45.510 | INFO | Task run 'Prediction with Cairo-0' - Finished in state Completed()\n", + "13:11:46.707 | INFO | Task run 'Prediction with Cairo-0' - Finished in state Completed()\n", "\n" ], "text/plain": [ - "18:27:45.510 | \u001b[36mINFO\u001b[0m | Task run 'Prediction with Cairo-0' - Finished in state \u001b[32mCompleted\u001b[0m()\n" + "13:11:46.707 | \u001b[36mINFO\u001b[0m | Task run 'Prediction with Cairo-0' - Finished in state \u001b[32mCompleted\u001b[0m()\n" ] }, "metadata": {}, @@ -2127,13 +2127,11 @@ { "data": { "text/html": [ - "18:27:45.513 | INFO | Action run 'blond-mouse' - Result: [ 9.22331238 -17.78359985 -1.26280212 0.61476135 -19.04953003\n", - " 5.17411804 -10.98361206 -7.69139099 -1.38302612 -7.62950134]\n", + "13:11:46.709 | INFO | Action run 'gleaming-falcon' - Result: 0\n", "
\n" ], "text/plain": [ - "18:27:45.513 | \u001b[36mINFO\u001b[0m | Action run 'blond-mouse' - Result: [ 9.22331238 -17.78359985 -1.26280212 0.61476135 -19.04953003\n", - " 5.17411804 -10.98361206 -7.69139099 -1.38302612 -7.62950134]\n" + "13:11:46.709 | \u001b[36mINFO\u001b[0m | Action run 'gleaming-falcon' - Result: 0\n" ] }, "metadata": {}, @@ -2142,11 +2140,11 @@ { "data": { "text/html": [ - "18:27:45.514 | INFO | Action run 'blond-mouse' - Request id: \"2c97ef6b2c464f668b2fe8748e77a3a9\"\n", + "13:11:46.710 | INFO | Action run 'gleaming-falcon' - Request id: \"e8ae9764ecdf4a01993d68b47fd75d22\"\n", "
\n" ], "text/plain": [ - "18:27:45.514 | \u001b[36mINFO\u001b[0m | Action run 'blond-mouse' - Request id: \"2c97ef6b2c464f668b2fe8748e77a3a9\"\n" + "13:11:46.710 | \u001b[36mINFO\u001b[0m | Action run 'gleaming-falcon' - Request id: \"e8ae9764ecdf4a01993d68b47fd75d22\"\n" ] }, "metadata": {}, @@ -2155,11 +2153,11 @@ { "data": { "text/html": [ - "18:27:45.638 | INFO | Action run 'blond-mouse' - Finished in state Completed()\n", + "13:11:46.806 | INFO | Action run 'gleaming-falcon' - Finished in state Completed()\n", "\n" ], "text/plain": [ - "18:27:45.638 | \u001b[36mINFO\u001b[0m | Action run 'blond-mouse' - Finished in state \u001b[32mCompleted\u001b[0m()\n" + "13:11:46.806 | \u001b[36mINFO\u001b[0m | Action run 'gleaming-falcon' - Finished in state \u001b[32mCompleted\u001b[0m()\n" ] }, "metadata": {}, @@ -2168,20 +2166,17 @@ { "data": { "text/plain": [ - "(array([ 9.22331238, -17.78359985, -1.26280212, 0.61476135,\n", - " -19.04953003, 5.17411804, -10.98361206, -7.69139099,\n", - " -1.38302612, -7.62950134]),\n", - " '\"2c97ef6b2c464f668b2fe8748e77a3a9\"')" + "(0, '\"e8ae9764ecdf4a01993d68b47fd75d22\"')" ] }, - "execution_count": 5, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "MODEL_ID = 199 # Update with your model ID\n", - "VERSION_ID = 5 # Update with your version ID\n", + "VERSION_ID = 7 # Update with your version ID\n", "\n", "\n", "@task(name=f'Prediction with Cairo')\n", @@ -2189,10 +2184,17 @@ " model = GizaModel(id=model_id, version=version_id)\n", "\n", " (result, request_id) = model.predict(\n", - " input_feed={\"image\": image}, verifiable=True, output_dtype=\"arr_fixed_point\"\n", + " input_feed={\"image\": image}, verifiable=True, output_dtype=\"tensor_fixed_point\"\n", " )\n", "\n", - " return result, request_id\n", + " # Convert result to a PyTorch tensor\n", + " result_tensor = torch.tensor(result)\n", + " # Apply softmax to convert to probabilities\n", + " probabilities = F.softmax(result_tensor, dim=1)\n", + " # Use argmax to get the predicted class\n", + " predicted_class = torch.argmax(probabilities, dim=1)\n", + "\n", + " return predicted_class.item(), request_id\n", "\n", "\n", "@action(name=f'Execution: Prediction with Cairo', log_prints=True)\n",