-
Notifications
You must be signed in to change notification settings - Fork 8
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
1d7a754
commit 99037a2
Showing
42 changed files
with
4,232 additions
and
96 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,116 +1,43 @@ | ||
# Giza Command Line Interface | ||
|
||
[![GitHub Workflow Status](https://github.com/gizatechxyz/giza-cli/actions/workflows/onpush.yml/badge.svg)](https://github.com/gizatechxyz/giza-cli/actions/workflows/onpush.yml) | ||
[![Project license](https://img.shields.io/github/license/gizatechxyz/orion.svg?style=flat-square)](LICENSE) | ||
[![Pull Requests welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg?style=flat-square)](https://github.com/gizatechxyz/orion/issues?q=is%3Aissue+is%3Aopen) | ||
[![Join the community](https://dcbadge.vercel.app/api/server/FR3Cd88x6r?style=flat-square)](https://discord.gg/FR3Cd88x6r) | ||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
|
||
```text | ||
_______ __ ________ ___ ______ __ __ | ||
/ _____|| | | / / \ / || | | | | ||
| | __ | | `---/ / / ^ \ | ,----'| | | | | ||
| | |_ | | | / / / /_\ \ | | | | | | | ||
| |__| | | | / /----./ _____ \ | `----.| `----.| | | ||
\______| |__| /________/__/ \__\ \______||_______||__| | ||
``` | ||
--- | ||
description: Giza CLI 0.9.0 | ||
--- | ||
|
||
# Giza CLI | ||
|
||
Welcome to Giza CLI! | ||
|
||
This CLI provides the utilities to interact with Giza using the terminal. | ||
|
||
**Disclaimer**: this is still in an experimental stage so the functionality is subject to change. | ||
|
||
- [Giza Command Line Interface](#giza-command-line-interface) | ||
- [🚀 Installation](#-installation) | ||
- [Recommended installation with pipx](#recommended-installation-with-pipx) | ||
- [Install from PyPi](#install-from-pypi) | ||
- [Installing from source](#installing-from-source) | ||
- [📚 Documentation](#-documentation) | ||
- [🌟 What's new](#-whats-new) | ||
- [🤝 Join the community!](#-join-the-community) | ||
- [Contributors ✨](#contributors-) | ||
- [License](#license) | ||
|
||
## 🚀 Installation | ||
|
||
### Recommended installation with pipx | ||
|
||
[pipx](https://pypa.github.io/pipx/) allows to install the dependency in an isolated environment. With this we can make sure that it does not conflict with any of our installed dependencies. | ||
|
||
```bash | ||
pipx install giza-cli | ||
``` | ||
|
||
### Install from PyPi | ||
|
||
For the latest release: | ||
|
||
```bash | ||
pip install giza-cli | ||
``` | ||
|
||
### Installing from source | ||
## 🤔 What capabilities does the CLI offer? | ||
|
||
Clone the repository and install it with `pip`: | ||
The CLI will serve as the main entrypoint for Giza Platform for developers. It aims to provide a tool to ease the managing of resources that exists in Giza Platform. | ||
|
||
```bash | ||
git clone [email protected]:gizatechxyz/giza-cli.git | ||
cd giza-cli | ||
pip install . | ||
``` | ||
For now it provides the following capabilities: | ||
|
||
Or install it directly from the repo: | ||
* User related utilities, like `create`, `login` (JWT Authentication) and `create_api_key` (API Key Authentication) | ||
* Model transpilation with `transpile` using multiple frameworks, like Cairo or EZKL | ||
* Model versioning | ||
* Proof generation for multiple frameworks, like Orion Cairo or EZKL | ||
* Deployment of models to the Giza Platform for verifiable inferences | ||
* Workspace management to help you with Giza Actions | ||
* Actions jumpstart with `new` command to help you get started with your actions | ||
|
||
```bash | ||
pip install git+ssh://[email protected]/gizatechxyz/giza-cli.git | ||
``` | ||
In the future each new resource added to Giza will have its corresponding capability in the CLI. | ||
|
||
## 📚 Documentation | ||
|
||
You can check our official docs [here](https://cli.gizatech.xyz). | ||
|
||
- **Examples** includes examples on how to use the CLI functionalities. | ||
|
||
- **Resources** brings the documentation of the different resources and actions that can be done with the CLI. | ||
|
||
- 🧠 **Reference** for the API reference and internals of the CLI. | ||
|
||
## 🌟 What's new | ||
## ✨ What's new? | ||
|
||
For a detailed list of changes, please refer to the [CHANGELOG](CHANGELOG.md) file. | ||
|
||
## 🤝 Join the community! | ||
## 💖 Join the community! | ||
|
||
Join the community and help build a safer and transparent AI in our [Discord](https://discord.gg/Kt24CsMb5k)! | ||
|
||
## Contributors ✨ | ||
## ✍️ Authors & contributors | ||
|
||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): | ||
|
||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
<!-- prettier-ignore-start --> | ||
<!-- markdownlint-disable --> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<td align="center" valign="top" width="14.28%"><a href="https://es.linkedin.com/in/gonzalo-mellizo-soto-diaz-590260108"><img src="https://avatars.githubusercontent.com/u/18899187?v=4?s=100" width="100px;" alt="Gonzalo Mellizo"/><br /><sub><b>Gonzalo Mellizo</b></sub></a><br /><a href="https://github.com/gizatechxyz/giza-cli/commits?author=Gonmeso" title="Code">💻</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/omahs"><img src="https://avatars.githubusercontent.com/u/73983677?v=4?s=100" width="100px;" alt="omahs"/><br /><sub><b>omahs</b></sub></a><br /><a href="https://github.com/gizatechxyz/giza-cli/commits?author=omahs" title="Documentation">📖</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/franalgaba"><img src="https://avatars.githubusercontent.com/u/24293857?v=4?s=100" width="100px;" alt="Fran Algaba"/><br /><sub><b>Fran Algaba</b></sub></a><br /><a href="https://github.com/gizatechxyz/giza-cli/commits?author=franalgaba" title="Documentation">📖</a></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<!-- markdownlint-restore --> | ||
<!-- prettier-ignore-end --> | ||
|
||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
|
||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! | ||
For a full list of all authors and contributors, see [the contributors page](https://github.com/gizatechxyz/giza-cli/graphs/contributors). | ||
|
||
## License | ||
|
||
[MIT](https://choosealicense.com/licenses/mit/) | ||
This project is licensed under the **MIT license**. | ||
|
||
See [LICENSE](LICENSE/) for more information. |
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,56 @@ | ||
# Table of contents | ||
|
||
## 🚀 Welcome | ||
|
||
* [Giza CLI](README.md) | ||
* [Installation](welcome/installation.md) | ||
* [Authentication](welcome/authentication.md) | ||
* [Frameworks](welcome/frameworks.md) | ||
* [Actions](welcome/actions.md) | ||
|
||
## 📦 Resources | ||
|
||
* [Users](resources/users.md) | ||
* [Models](resources/models.md) | ||
* [Versions](resources/versions.md) | ||
* [Workspaces](resources/workspaces.md) | ||
* [Deployments](resources/deployments.md) | ||
|
||
## 📚 Frameworks | ||
|
||
* [Cairo](frameworks/cairo/README.md) | ||
* [Transpile](frameworks/cairo/transpile.md) | ||
* [Prove](frameworks/cairo/prove.md) | ||
* [Verify](frameworks/cairo/verify.md) | ||
* [EZKL](frameworks/ezkl/README.md) | ||
* [Transpile](frameworks/ezkl/transpile.md) | ||
* [Prove](frameworks/ezkl/prove.md) | ||
* [Verify](frameworks/ezkl/verify.md) | ||
|
||
## 📖 Examples | ||
|
||
* [Basic Cairo CLI Example](examples/basic.md) | ||
* [Reset Your Password](examples/reset\_password.md) | ||
|
||
## 🧱 Reference | ||
|
||
* [API Overview](reference/api/README.md) | ||
* [callbacks](reference/api/callbacks.md) | ||
* [cli](reference/api/cli.md) | ||
* [client](reference/api/client.md) | ||
* [commands](reference/api/commands.md) | ||
* [commands.deploy](reference/api/commands.deploy.md) | ||
* [commands.models](reference/api/commands.models.md) | ||
* [commands.prove](reference/api/commands.prove.md) | ||
* [commands.reset\_password](reference/api/commands.reset\_password.md) | ||
* [commands.transpile](reference/api/commands.transpile.md) | ||
* [commands.users](reference/api/commands.users.md) | ||
* [commands.version](reference/api/commands.version.md) | ||
* [commands.versions](reference/api/commands.versions.md) | ||
* [commands.workspaces](reference/api/commands.workspaces.md) | ||
* [exceptions](reference/api/exceptions.md) | ||
* [options](reference/api/options.md) | ||
* [utils.decorators](reference/api/utils.decorators.md) | ||
* [utils.echo](reference/api/utils.echo.md) | ||
* [utils.enum](reference/api/utils.enum.md) | ||
* [utils](reference/api/utils.md) |
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,115 @@ | ||
# Basic Cairo CLI Example | ||
|
||
For this example we will create a user, retrieve information from it and transpile a model. | ||
|
||
## Create User | ||
|
||
This is the first step! We create the user and then we need to verify the account by checking the email. | ||
|
||
```console | ||
> giza users create | ||
|
||
Enter your username 😎: my-username | ||
Enter your password 🥷 : (this is a secret) | ||
Enter your email 📧: [email protected] | ||
[giza][2023-06-23 12:29:40.543] Creating user in Giza ✅ | ||
[giza][2023-06-23 12:29:41.417] User created ✅. Check for a verification email 📧 | ||
``` | ||
|
||
Then we need to verify the email. We just need to click on the button and we'll be redirected to the verification endpoint. | ||
|
||
## Login | ||
|
||
If it is not verified login will be disabled! | ||
|
||
```console | ||
> giza users login | ||
|
||
Enter your username 😎: my-username | ||
Enter your password 🥷 : | ||
[giza][2023-06-23 12:32:17.917] Log into Giza | ||
[giza][2023-06-23 12:32:18.716] ⛔️Could not authorize the user⛔️ | ||
[giza][2023-06-23 12:32:18.718] ⛔️Status code -> 400⛔️ | ||
[giza][2023-06-23 12:32:18.719] ⛔️Error message -> {'detail': 'Inactive user'}⛔️ | ||
``` | ||
|
||
But once we verify the account we will be able to authenticate with Giza. | ||
|
||
```console | ||
> giza users login | ||
|
||
Enter your username 😎: my-username | ||
Enter your password 🥷 : | ||
[giza][2023-06-23 12:34:33.576] Log into Giza | ||
[giza][2023-06-23 12:34:34.400] Successfully logged into Giza ✅ | ||
``` | ||
|
||
## Retrieve user information | ||
|
||
Now that we are authenticated we can connect with Giza! | ||
|
||
```console | ||
> giza users me | ||
|
||
[giza][2023-06-23 12:35:33.287] Retrieving information about me! | ||
{ | ||
"username": "my-username", | ||
"email": "[email protected]", | ||
"is_active": true | ||
} | ||
``` | ||
|
||
## Create API Key | ||
|
||
You can also create an API key for the current user. This API key will be stored and will be used to authenticate the user in the future. | ||
|
||
```console | ||
> giza users create-api-key | ||
[giza][2024-01-17 15:27:27.936] Creating API Key ✅ | ||
[giza][2024-01-17 15:27:53.605] API Key written to: /Users/gizabrain/.giza/.api_key.json | ||
[giza][2024-01-17 15:27:53.606] Successfully created API Key. It will be used for future requests ✅ | ||
``` | ||
|
||
**NOTE: The usage of API key is less secure than JWT, so use it with caution.** | ||
|
||
## Transpiling a Model | ||
|
||
Now that we have our `onnx` model, it's time to transpile it into a format that's compatible with `giza`. Transpilation is a process where we convert the model from one format to another without changing its underlying functionality. In this case, we're converting our `onnx` model into a `cairo` model. This is a crucial step as it allows us to leverage the power of `giza` and its ecosystem. | ||
|
||
But don't worry, `giza` makes this process a breeze with a simple command! Let's dive into it. | ||
|
||
```console | ||
> giza transpile awesome_model.onnx --output-path cairo_model | ||
|
||
[giza][2023-09-13 12:56:43.725] No model id provided, checking if model exists ✅ | ||
[giza][2023-09-13 12:56:43.726] Model name is: awesome_model | ||
[giza][2023-09-13 12:56:43.978] Model Created with id -> 25! ✅ | ||
[giza][2023-09-13 12:56:44.568] Sending model for transpilation ✅ | ||
[giza][2023-09-13 12:56:55.577] Transpilation recieved! ✅ | ||
[giza][2023-09-13 12:56:55.583] Transpilation saved at: cairo_model | ||
``` | ||
|
||
As you can see from the console output, if the model does not previously exist, `giza` will automatically create one for you. It assigns a unique id to the new model, in this case, the id is 25. This is indicated by the line `[giza][2023-09-13 12:56:43.978] Model Created with id -> 25! ✅`. | ||
|
||
After the model is created, `giza` will create a new version for it and send it for transpilation. This is indicated by the line `[giza][2023-09-13 12:56:44.568] Sending model for transpilation ✅`. The transpiled model is then saved at the specified output path. | ||
|
||
This feature of `giza` makes it easy to manage and version your models. You don't have to worry about manually creating a new model or version, `giza` handles it for you. | ||
|
||
Additionally, `giza` provides an option to specify the model id while transpiling. If you already have a model and want to create a new version for it, you can use the `--model-id` option followed by the id of the model. This will create a new version for the existing model instead of creating a new model. Here's how you can do it: | ||
|
||
Now let's check the result: | ||
|
||
```console | ||
> tree cairo_model | ||
|
||
cairo_model | ||
├── inference | ||
│ ├── Scarb.toml | ||
│ └── src | ||
│ └── lib.cairo | ||
└── initializers | ||
├── node_l1 | ||
│ ├── Scarb.toml | ||
│ └── src | ||
│ └── lib.cairo | ||
``` |
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,35 @@ | ||
# Reset Password Example | ||
|
||
In case you forget your password, Giza provides a secure and straightforward way to reset it. The process involves two main steps: | ||
|
||
## Request a Reset Token | ||
|
||
The first step is to request a reset token. This token will be sent to your registered email address. You can request a reset token by running the following command: | ||
|
||
```console | ||
> giza request-reset-password-token --email [email protected] | ||
|
||
[giza][2023-08-30 12:53:18.423] Password recovery email sent | ||
[giza][2023-08-30 12:53:18.428] Please check your email for a password reset token 📬 | ||
``` | ||
|
||
The reset token is a unique string of characters that is used to verify your identity and allow you to change your password. It is only valid for a short period of time for security reasons. If you do not use it within this time, you will need to request a new one. | ||
|
||
## Reset Password | ||
|
||
Once you have received your reset token, you can use it to reset your password. Run the following command, replacing `your_reset_token` with the token you received in your email: | ||
|
||
```console | ||
> giza reset-password --token your_reset_token | ||
|
||
Please enter your new password 🔑: # Your new password goes here | ||
Please confirm your new password 🔑: | ||
[giza][2023-08-30 12:55:32.128] Password updated successfully | ||
[giza][2023-08-30 12:55:32.132] Password reset was successful 🎉 | ||
``` | ||
|
||
With the above steps, you have successfully reset your password. Remember, it's important to keep your password secure and not share it with anyone. If you suspect that your password has been compromised, repeat the steps above to reset it. | ||
|
||
In case you encounter any issues or need further assistance, feel free to reach out to our support team. We're here to help! | ||
|
||
Stay secure! 🔒 |
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,12 @@ | ||
# Cairo | ||
|
||
Cairo is a programming language specifically designed for creating verifiable and efficient smart contracts and cryptographic proofs. Its core strength lies in its ability to create succinct and secure programs while ensuring formal verification of their correctness. | ||
|
||
In the realm of Giza, Cairo serves as the backbone for generating provable machine learning models. Leveraging Cairo as the backend provides a reliable infrastructure to transpile, prove and verify these models within the Giza platform. | ||
|
||
## Cairo Framework Features | ||
|
||
1. Transpilation Process: Dive into Giza's streamlined process to seamlessly convert ONNX machine learning models into Cairo code. This transformation ensures optimal compatibility and functionality within the Cairo ecosystem, leveraging the power of [✨Orion✨](https://github.com/gizatechxyz/orion). More on this in the [transpile documentation for cairo](transpile.md). | ||
2. Creating Verifiable Proofs: Use the transpile model to generate the `casm.json` file to create a proof and validate the correctness and reliability of your transformed models. Discover how Giza harnesses Cairo's robust features to create evidence ensuring the credibility of your machine learning outputs. More on this in the [prove documentation for cairo](prove.md). | ||
|
||
[Cairo official documentation](https://docs.cairo-lang.org/) |
Oops, something went wrong.