Skip to content

Commit

Permalink
Update verifiable_mnist.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelDkhn committed Feb 8, 2024
1 parent ee78e55 commit 1491e5c
Showing 1 changed file with 17 additions and 34 deletions.
51 changes: 17 additions & 34 deletions examples/verifiable_mnist/verifiable_mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1709,48 +1709,31 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we converted to ONNX, use the Giza-CLI to transpile your model to Orion Cairo code. \n",
"Follow these steps to transpile your model to Orion Cairo code, compile the transpiled project, and deploy it on the Giza platform.\n",
"\n",
"```bash\n",
"giza transpile mnist_model.onnx --output-path verifiable_mnist\n",
"```\n",
"\n",
"After your model has been transpiled, it's ready for deployment on the Giza platform. Our platform's deployment process establishes services capable of accepting prediction requests through a specific endpoint. These services leverage Cairo under the hood to ensure provable inferences.\n",
"\n",
"To create a new service, users can employ the `deploy` command. The following command facilitates the deployment of a machine learning service ready to accept predictions at the `/cairo_run` endpoint.\n",
"### Step 1: Transpile Your Model\n",
"Now that your model is converted to ONNX format, use the Giza-CLI to transpile it to Orion Cairo code:\n",
"\n",
"```bash\n",
"giza deployments deploy --model-id 1 --version-id 1 inference.sierra\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### How to Obtain the Sierra File?\n",
"$ giza transpile mnist_model.onnx --output-path verifiable_mnist\n",
">>> \n",
"[giza][2024-02-07 16:32:13.511] Transpilation is fully compatible. \n",
"Version compiled and Sierra is saved at Giza ✅\n",
"```\n",
"\n",
"To deploy a Cairo model, you will need to provide its Sierra file. Sierra is an intermediate representation between high level Cairo and compilation targets, such as CASM. To obtain this file, follow these steps:\n",
"### Step 2: Deploy Your Model\n",
"Thanks to full support for all operators used by MNIST model in the transpiler, your transpilation process is completely compatible. This ensures that your project compiles smoothly and has already been compiled behind the scenes on our platform. \n",
"\n",
"1. Navigate to your transpiled Cairo model directory:\n",
" ```bash\n",
" $ cd verifiable_mnist/inference\n",
" ```\n",
"🚨: If your model incorporates operators that aren't supported by the transpiler, you may need to refine your Cairo project to ensure successful compilation. For more details, refer to the to [how-to-guide](https://actions.gizatech.xyz/how-to-guides/gizamodel#executing-verifiable-inference-with-gizamodel-and-onnx).\n",
"\n",
"2. Compile your model using Scarb (make sure to have [Scarb](https://docs.swmansion.com/scarb/download.html) installed):\n",
"With your model transpiled and compiled, it's now ready for deployment on the Giza platform. Our deployment process sets up services that handle prediction requests via a designated endpoint, using Cairo to ensure the provability of inferences.\n",
"\n",
" ```bash\n",
" $ scarb build\n",
" ```\n",
"**Creating a New Deployment Service**\n",
"\n",
"3. The Sierra file can be found in the generated directory at `target/dev/inference.sierra`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Please keep in mind that if your model contains ONNX operators not currently supported by the Transpiler, the transpilation process will fail. We are actively working towards achieving 100% ONNX compatibility in both Orion and the Transpiler."
"Deploy your service, which will be ready to accept prediction requests at the /cairo_run endpoint, by using the following command:\n",
"```bash\n",
"giza deployments deploy --model-id <MODEL_ID> --version-id <VERSION_ID>\n",
"```"
]
},
{
Expand Down

0 comments on commit 1491e5c

Please sign in to comment.