Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update to Cairo & Scarb v2.4.0 #494

Merged
merged 4 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
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
10 changes: 7 additions & 3 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[package]
name = "orion"
version = "0.1.7"
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
2 changes: 1 addition & 1 deletion docs/framework/operators/tensor/tensor.asinh.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.at.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The `T` value at the specified indices.
# Examples

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

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

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/operators/tensor/tensor.atan.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
2 changes: 1 addition & 1 deletion docs/framework/operators/tensor/tensor.binarizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Constrain input and output types to fixed point numbers.
## 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
Loading