-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
353dfc6
commit fa53627
Showing
7 changed files
with
216 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Deploy | ||
|
||
To deploy a model, you must first have a version of that model. If you have not yet created a version, please refer to the [versions](../../resources/versions.md) documentation. | ||
|
||
To create a new service, users can employ the `deploy` command. This command facilitates the deployment of a machine learning service ready to accept predictions at the `/cairo_run` endpoint, providing a straightforward method for deploying and using machine learning capabilities | ||
|
||
``` | ||
> giza deployments deploy --model-id 1 --version-id 1 model.sierra | ||
▰▰▰▰▰▱▱ Creating deployment! | ||
[giza][2024-02-07 12:31:02.498] Deployment is successful ✅ | ||
[giza][2024-02-07 12:31:02.501] Deployment created with id -> 1 ✅ | ||
[giza][2024-02-07 12:31:02.502] Deployment created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app 🎉 | ||
``` | ||
|
||
If a model is fully compatible the sierra file is not needed and can be deployed without using it in the command: | ||
|
||
``` | ||
> giza deployments deploy --model-id 1 --version-id 1 | ||
▰▰▰▰▰▱▱ Creating deployment! | ||
[giza][2024-02-07 12:31:02.498] Deployment is successful ✅ | ||
[giza][2024-02-07 12:31:02.501] Deployment created with id -> 1 ✅ | ||
[giza][2024-02-07 12:31:02.502] Deployment created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app 🎉 | ||
``` | ||
|
||
{% hint style="danger" %} | ||
For a partially compatible model, the sierra file must be provided, if not an error will be shown. | ||
{% endhint %} | ||
|
||
### Example request | ||
|
||
Now our service is ready to accept predictions at the provided endpoint URL. To test this, we can use the `curl` command to send a POST request to the endpoint with a sample input. | ||
|
||
``` | ||
> curl -X POST https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app/cairo_run \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"args": "[2 2] [1 2 3 4]" | ||
}' | jq | ||
{ | ||
"result": [0.1234], | ||
"request_id": "b14bfbcf250b404192765d9be0811c9b" | ||
} | ||
``` | ||
|
||
There is an extra args, `job_size`, that can be used in each request to specify the size of the proving job so it has more CPU and memory available to generate the proof. An example: | ||
|
||
``` | ||
> curl -X POST https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app/cairo_run \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"args": "[2 2] [1 2 3 4]", | ||
"job_size": "M" | ||
}' | ||
``` | ||
|
||
Available sizes are `S`, `M`, `L,` and `XL`, each with different usage limits. | ||
|
||
## Download the proof | ||
|
||
We can download the proof using the `download-proof` command available for the deployments:  | ||
|
||
<pre class="language-sh"><code class="lang-sh"><strong>❯ giza deployments download-proof --model-id 1 --version-id 1 --deployment-id 1 --proof-id "b14bfbcf250b404192765d9be0811c9b" | ||
</strong>[giza][2024-02-20 15:40:48.560] Getting proof from deployment 1 ✅ | ||
[giza][2024-02-20 15:40:49.288] Proof downloaded to zk.proof ✅ | ||
</code></pre> | ||
|
||
The `proof id` used is the `request_id` returned in the response. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Deploy | ||
|
||
To deploy a model, you must first have a version of that model. If you have not yet created a version, please refer to the [versions](../../resources/versions.md) documentation. | ||
|
||
To create a new service, users can employ the `deploy` command. This command facilitates the deployment of a machine learning service ready to accept predictions at the `/predict` endpoint, providing a straightforward method for deploying and using machine learning capabilities. As we are using `EZKL` we need to add `--framework EZKL` (or `-f EZKL` for short) to the command: | ||
|
||
{% code overflow="wrap" %} | ||
```shell | ||
> giza deployments deploy --model-id 1 --version-id 1 --framework EZKL | ||
▰▰▰▰▰▱▱ Creating deployment! | ||
[giza][2024-02-07 12:31:02.498] Deployment is successful ✅ | ||
[giza][2024-02-07 12:31:02.501] Deployment created with id -> 1 ✅ | ||
[giza][2024-02-07 12:31:02.502] Deployment created with endpoint URL: https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app 🎉 | ||
``` | ||
{% endcode %} | ||
|
||
## Example Request | ||
|
||
Now the model is available to generate predictions and generate proofs of those predictions. The schema of the data is the same as used to create the `input.json` needed to create version, for a linear regression it would be: | ||
|
||
```json | ||
{ | ||
"input_data": [ | ||
[ | ||
0.12177091836929321, | ||
0.7048522233963013 | ||
] | ||
] | ||
} | ||
``` | ||
|
||
To execute a prediction using **cURL**: | ||
|
||
```sh | ||
curl https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app/predict \ | ||
-H "Content-Type: application/json" -d '{ | ||
"input_data": [ | ||
[ | ||
0.12177091836929321, | ||
0.7048522233963013 | ||
] | ||
] | ||
}' | jq | ||
``` | ||
|
||
This yields the following response: | ||
|
||
```json | ||
{ | ||
"prediction": [ | ||
[ | ||
4.53125 | ||
] | ||
], | ||
"request_id": "d0564505755944b8bef9292d980f3e27" | ||
} | ||
``` | ||
|
||
There is an extra args, `job_size`, that can be used in each request to specify the size of the proving job so it has more CPU and memory available to generate the proof. An example: | ||
|
||
```sh | ||
curl https://deployment-gizabrain-38-1-53427f44-dagsgas-ew.a.run.app/predict \ | ||
-H "Content-Type: application/json" -d '{ | ||
"input_data": [ | ||
[ | ||
0.12177091836929321, | ||
0.7048522233963013 | ||
] | ||
], | ||
"job_size": "M" | ||
}' | jq | ||
``` | ||
|
||
Available sizes are `S`, `M`, `L,` and `XL`, each with different usage limits. | ||
|
||
## Download the proof | ||
|
||
We can download the proof using the `download-proof` command available for the deployments:  | ||
|
||
<pre class="language-sh"><code class="lang-sh"><strong>❯ giza deployments download-proof --model-id 1 --version-id 1 --deployment-id 1 --proof-id "d0564505755944b8bef9292d980f3e27" | ||
</strong>[giza][2024-02-20 15:40:48.560] Getting proof from deployment 1 ✅ | ||
[giza][2024-02-20 15:40:49.288] Proof downloaded to zk.proof ✅ | ||
</code></pre> | ||
|
||
The `proof id` used is the `request_id` returned in the response. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Installation | ||
|