Skip to content

Commit

Permalink
Merge pull request #496 from gizatechxyz/develop
Browse files Browse the repository at this point in the history
Merge Develop into Main
  • Loading branch information
raphaelDkhn authored Dec 10, 2023
2 parents d392123 + de6129e commit 524ff0b
Show file tree
Hide file tree
Showing 3,104 changed files with 4,040 additions and 4,487 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 10 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"name": "Mahmoud Mohajer",
"avatar_url": "https://avatars.githubusercontent.com/u/89094323?v=4",
"profile": "https://medium.com/@mohajermahmoud3",
"contributions": [
"contributions": [
"code"
]
},
Expand All @@ -251,6 +251,15 @@
"contributions": [
"code"
]
},
{
"login": "akhercha",
"name": "akhercha",
"avatar_url": "https://avatars.githubusercontent.com/u/22559023?v=4",
"profile": "https://t.me/notaihe",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.3.0"
scarb-version: "2.4.0"
- run: scarb test --workspace && scarb fmt --workspace
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

# Orion: An Open-source Framework for Validity and ZK ML ✨
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-25-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-28-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

Orion is an open-source, community-driven framework dedicated to Provable Machine Learning. It provides essential components and a new ONNX runtime for building verifiable Machine Learning models using [STARKs](https://starkware.co/stark/).
Expand Down Expand Up @@ -102,6 +102,7 @@ Thanks goes to these wonderful people:
<td align="center" valign="top" width="14.28%"><a href="https://medium.com/@mohajermahmoud3"><img src="https://avatars.githubusercontent.com/u/89094323?v=4?s=100" width="100px;" alt="Mahmoud Mohajer"/><br /><sub><b>Mahmoud Mohajer</b></sub></a><br /><a href="https://github.com/gizatechxyz/orion/commits?author=MahmoudMohajer" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/HappyTomatoo"><img src="https://avatars.githubusercontent.com/u/143050661?v=4?s=100" width="100px;" alt="HappyTomatoo"/><br /><sub><b>HappyTomatoo</b></sub></a><br /><a href="https://github.com/gizatechxyz/orion/issues?q=author%3AHappyTomatoo" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.bilginkocak.com/"><img src="https://avatars.githubusercontent.com/u/30844607?v=4?s=100" width="100px;" alt="Bilgin Koçak"/><br /><sub><b>Bilgin Koçak</b></sub></a><br /><a href="https://github.com/gizatechxyz/orion/commits?author=bilgin-kocak" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://t.me/notaihe"><img src="https://avatars.githubusercontent.com/u/22559023?v=4?s=100" width="100px;" alt="akhercha"/><br /><sub><b>akhercha</b></sub></a><br /><a href="https://github.com/gizatechxyz/orion/commits?author=akhercha" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
12 changes: 8 additions & 4 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[package]
name = "orion"
version = "0.1.7"
version = "0.1.9"
cairo-version = "2.4.0"
edition = "2023_10"
description = "ONNX Runtime in Cairo for verifiable ML inference using STARK"
homepage = "https://github.com/gizatechxyz/orion"

[dependencies]
alexandria_data_structures = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "f37d73d" }
alexandria_sorting = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "f37d73d" }
cubit = { git = "https://github.com/influenceth/cubit.git", rev = "b459053" }
alexandria_merkle_tree = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "01a7690" }
alexandria_data_structures = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "01a7690" }
alexandria_sorting = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "01a7690" }
# TODO: update to https://github.com/influenceth/cubit & change rev
cubit = { git = "https://github.com/akhercha/cubit.git", rev = "d3869a3" }

[scripts]
sierra = "cairo-compile . -r"
Expand Down
2 changes: 1 addition & 1 deletion docs/academy/tutorials/implement-new-operators-in-orion.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ trait NNTrait<T> {
/// ## Examples
///
/// ```rust
/// use array::{ArrayTrait, SpanTrait};
/// use core::array::{ArrayTrait, SpanTrait};
///
/// use orion::operators::tensor::{TensorTrait, Tensor, FP8x23};
/// use orion::operators::nn::{NNTrait, FP8x23NN};
Expand Down
4 changes: 2 additions & 2 deletions docs/academy/tutorials/mnist-classification-with-orion.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ os.makedirs('src/generated', exist_ok=True)
for tensor_name, tensor in tensors.items():
with open(os.path.join('src', 'generated', f"{tensor_name}.cairo"), "w") as f:
f.write(
"use array::ArrayTrait;\n" +
"use core::array::ArrayTrait;\n" +
"use orion::operators::tensor::{TensorTrait, Tensor, I32Tensor};\n" +
"use orion::numbers::i32;\n\n" +
"\nfn {0}() -> Tensor<i32> ".format(tensor_name) + "{\n" +
Expand Down Expand Up @@ -431,7 +431,7 @@ We have just created a file called `lib.cairo`, which contains a module declarat
Here is a file we generated: `fc1_bias.cairo`

```rust
use array::ArrayTrait;
use core::array::ArrayTrait;
use orion::operators::tensor::{TensorTrait, Tensor, I32Tensor};
use orion::numbers::i32;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def generate_cairo_files(data, name):
os.makedirs('src/generated', exist_ok=True)
with open(os.path.join('src', 'generated', f"{name}.cairo"), "w") as f:
f.write(
"use array::ArrayTrait;\n" +
"use core::array::ArrayTrait;\n" +
"use orion::operators::tensor::{FP16x16Tensor, TensorTrait, Tensor};\n" +
"use orion::numbers::{FixedTrait, FP16x16, FP16x16Impl};\n"
"\nfn {0}() -> Tensor<FixedType> ".format(name) + "{\n" +
Expand Down Expand Up @@ -200,7 +200,7 @@ mod lin_reg_func;
This will tell our compiler to include the separate modules listed above during the compilation of our code. We will be covering each module in detail in the following section, but let’s first review the generated folder files.

```rust
use array::ArrayTrait;
use core::array::ArrayTrait;
use orion::operators::tensor::{FP16x16Tensor, TensorTrait, Tensor};
use orion::numbers::{FixedTrait, FP16x16, FP16x16Impl};

Expand Down Expand Up @@ -343,7 +343,7 @@ Calculating the y-intercept is fairly simple, we just need to substitute the cal
Now that we have implemented all the necessary functions for the OLS method, we can finally test our linear regression model. We begin by creating a new separate test file named `test.cairo` and import all the necessary Orion libraries including our `X_values` and `y_values` found in the generated folder. We also import all the OLS functions from `lin_reg_func.cairo` file as we will be relying upon them to construct the regression model.

```rust
use debug::PrintTrait;
use core::debug::PrintTrait;

use verifiable_linear_regression::generated::X_values::X_values;
use verifiable_linear_regression::generated::Y_values::Y_values;
Expand Down
10 changes: 5 additions & 5 deletions docs/academy/tutorials/verifiable-support-vector-machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def generate_cairo_files(data, name):

with open(os.path.join('src', 'generated', f"{name}.cairo"), "w") as f:
f.write(
"use array::ArrayTrait;\n" +
"use core::array::ArrayTrait;\n" +
"use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor};\n" +
"use orion::numbers::{FixedTrait, FP16x16, FP16x16Impl};\n" +
"\n" + f"fn {name}() -> Tensor<FP16x16>" + "{\n\n" +
Expand Down Expand Up @@ -237,7 +237,7 @@ mod helper;
This will tell our compiler to include the separate modules listed above during the compilation of our code. We will be covering each module in detail in the following section, but let’s first review the generated folder files.

```rust
use array::ArrayTrait;
use core::array::ArrayTrait;
use orion::operators::tensor::{Tensor, TensorTrait, FP16x16Tensor};
use orion::numbers::{FixedTrait, FP16x16, FP16x16Impl};

Expand Down Expand Up @@ -449,9 +449,9 @@ fn pred(x: @Tensor<FP16x16>, w: @Tensor<FP16x16>) -> Tensor<FP16x16> {
Finally, our `train.cairo` file implements model training using the functions described earlier and is executed as part of our model tests.

```rust
use debug::PrintTrait;
use core::debug::PrintTrait;
use traits::TryInto;
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};
use orion::operators::tensor::{
Tensor, TensorTrait, FP16x16Tensor, FP16x16TensorAdd, FP16x16TensorMul, FP16x16TensorSub,
FP16x16TensorDiv
Expand Down Expand Up @@ -576,7 +576,7 @@ Now that we have implemented all the necessary functions for SVM, we can finally

```rust
use traits::TryInto;
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};
use orion::operators::tensor::{
Tensor, TensorTrait, FP16x16Tensor, FP16x16TensorAdd, FP16x16TensorMul, FP16x16TensorSub,
FP16x16TensorDiv
Expand Down
4 changes: 2 additions & 2 deletions docs/framework/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
In this section, we will guide you to start using Orion successfully. We will help you install Cairo 1.0 and add Orion dependency in your project.

{% hint style="info" %}
Orion supports <mark style="color:orange;">**Cairo and Scarb v2.3.0**</mark>
Orion supports <mark style="color:orange;">**Cairo and Scarb v2.4.0**</mark>
{% endhint %}

## 📦 Installations
Expand Down Expand Up @@ -56,7 +56,7 @@ scarb build
You can now use the `orion` in your files:

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, I32Tensor};
use orion::operators::nn::{NNTrait, I32NN};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/neural-network/nn.hard_sigmoid.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Constrain input and output types to fixed point tensors.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23};
use orion::operators::nn::{NNTrait, FP8x23NN};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/neural-network/nn.leaky_relu.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Constrain input and output types to fixed point tensors.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23};
use orion::operators::nn::{NNTrait, FP8x23NN};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/neural-network/nn.linear.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A `Tensor<T>` representing the result of the linear transformation.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, I32Tensor};
use orion::operators::nn::{NNTrait, I32NN};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/neural-network/nn.logsoftmax.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Constrain input and output types to fixed point tensors.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23};
use orion::operators::nn::{NNTrait, FP8x23NN};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/neural-network/nn.relu.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A `Tensor<T>` with the same shape as the input tensor.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, I32Tensor};
use orion::operators::nn::{NNTrait, I32NN};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/neural-network/nn.sigmoid.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Constrain input and output types to fixed point tensors.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23};
use orion::operators::nn::{NNTrait, FP8x23NN};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/neural-network/nn.softmax.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Constrain input and output types to fixed point tensors.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23Tensor};
use orion::operators::nn::{NNTrait, FP8x23NN};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/neural-network/nn.softplus.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Constrain input and output types to fixed point tensors.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23};
use orion::operators::nn::{NNTrait, FP8x23NN};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/neural-network/nn.softsign.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Constrain input and output types to fixed point tensors.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23};
use orion::operators::nn::{NNTrait, FP8x23NN};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Constrain input and output types to fixed point tensors.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23};
use orion::operators::nn::{NNTrait, FP8x23NN};
Expand Down
4 changes: 2 additions & 2 deletions docs/framework/operators/tensor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Two tensors are “broadcastable” if the following rules hold:
Element-wise add.

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor, U32TensorAdd};

fn element_wise_add_example() -> Tensor<u32> {
Expand All @@ -158,7 +158,7 @@ fn element_wise_add_example() -> Tensor<u32> {
Add two tensors of different shapes but compatible in broadcasting.

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};
use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor, U32TensorAdd};

fn broadcasting_add_example() -> Tensor<u32> {
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/tensor/tensor.abs.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ the absolute value of all elements in the input tensor.
## Example

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, I32Tensor};
use orion::numbers::{i32, IntegerTrait};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/tensor/tensor.acos.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Constrain input and output types to fixed point tensors.
## Example

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23Tensor};
use orion::numbers::{FP8x23, FixedTrait};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/tensor/tensor.acosh.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Constrain input and output types to fixed point tensors.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23Tensor};
use orion::numbers::{FixedTrait, FP8x23};
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/tensor/tensor.and.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ A new `Tensor<bool>` with the same shape as the broadcasted inputs.
## Examples

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};

Expand Down
6 changes: 3 additions & 3 deletions docs/framework/operators/tensor/tensor.argmax.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ A new `Tensor<T>` instance containing the indices of the maximum values along th
Case 1: argmax with default parameters

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};

Expand All @@ -43,7 +43,7 @@ fn argmax_example() -> Tensor<usize> {
Case 2: argmax with keepdims set to false

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};

Expand All @@ -62,7 +62,7 @@ fn argmax_example() -> Tensor<usize> {
Case 3: argmax with select_last_index set to true

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};

Expand Down
6 changes: 3 additions & 3 deletions docs/framework/operators/tensor/tensor.argmin.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ A new `Tensor<T>` instance containing the indices of the minimum values along th
Case 1: argmin with default parameters

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};

Expand All @@ -44,7 +44,7 @@ fn argmin_example() -> Tensor<usize> {
Case 2: argmin with keepdims set to false

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};

Expand All @@ -63,7 +63,7 @@ fn argmin_example() -> Tensor<usize> {
Case 3: argmin with select_last_index set to true

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, U32Tensor};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A new `Tensor<T>` of the same shape as the input tensor with selected elements b
## Example

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};
use orion::operators::tensor::{TensorTrait, Tensor, I32Tensor, U32Tensor};
use orion::numbers::{i32, IntegerTrait};

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/tensor/tensor.asin.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Constrain input and output types to fixed point tensors.
## Example

```rust
use array::{ArrayTrait, SpanTrait};
use core::array::{ArrayTrait, SpanTrait};

use orion::operators::tensor::{TensorTrait, Tensor, FP8x23Tensor};
use orion::numbers::{FixedTrait, FP8x23};
Expand Down
Loading

0 comments on commit 524ff0b

Please sign in to comment.