Skip to content

Commit

Permalink
Merge pull request #821 from ia0/fix-817
Browse files Browse the repository at this point in the history
Pin ort version and update vulnerable rustls
  • Loading branch information
reyammer authored Nov 29, 2024
2 parents f510283 + dc32fb7 commit ed4e54f
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 49 deletions.
6 changes: 6 additions & 0 deletions rust/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.1.0-rc.3-dev

### Patch

- Update dependencies

## 0.1.0-rc.2

### Minor
Expand Down
16 changes: 8 additions & 8 deletions rust/cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions rust/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "magika-cli"
version = "0.1.0-rc.2"
version = "0.1.0-rc.3-dev"
authors = ["Magika Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -20,9 +20,9 @@ anyhow = "1.0.86"
async-channel = "2.3.1"
clap = { version = "4.5.9", features = ["cargo", "derive", "string"] }
colored = "2.1.0"
magika = { version = "=0.1.0-rc.2", path = "../lib", features = ["serde"] }
magika = { version = "=0.1.0-rc.3-dev", path = "../lib", features = ["serde"] }
num_cpus = "1.16.0"
ort = "2.0.0-rc.8"
ort = "=2.0.0-rc.9"
serde = { version = "1.0.204", features = ["derive"] }
serde_json = "1.0.120"
tokio = { version = "1.38.1", features = ["full"] }
2 changes: 1 addition & 1 deletion rust/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use anyhow::{bail, ensure, Result};
use clap::{Args, Parser};
use colored::{ColoredString, Colorize};
use magika::{ContentType, Features, FeaturesOrRuled, FileType, RuledType, Session, TypeInfo};
use ort::GraphOptimizationLevel;
use ort::session::builder::GraphOptimizationLevel;
use serde::Serialize;
use tokio::fs::File;
use tokio::io::AsyncReadExt;
Expand Down
6 changes: 6 additions & 0 deletions rust/lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.1.0-rc.3-dev

### Patch

- Update dependencies

## 0.1.0-rc.2

### Patch
Expand Down
27 changes: 5 additions & 22 deletions rust/lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions rust/lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "magika"
version = "0.1.0-rc.2"
version = "0.1.0-rc.3-dev"
authors = ["Magika Developers <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -27,10 +27,9 @@ thiserror = "1.0.63"
tokio = { version = "1.38.1", features = ["fs", "io-util"] }

[dependencies.ort]
version = "2.0.0-rc.8"
version = "=2.0.0-rc.9"
default-features = false
# TODO: Remove "half" when rc.9 is released.
features = ["ndarray", "half"]
features = ["ndarray"]

[dev-dependencies]
data-encoding = "2.6.0"
Expand Down
4 changes: 2 additions & 2 deletions rust/lib/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use ort::GraphOptimizationLevel;
use ort::session::builder::GraphOptimizationLevel;

use crate::{Result, Session};

Expand Down Expand Up @@ -52,7 +52,7 @@ impl Builder {

/// Consumes the builder to create a Magika session.
pub fn build(self) -> Result<Session> {
let mut session = ort::Session::builder()?;
let mut session = ort::session::Session::builder()?;
let Builder { inter_threads, intra_threads, optimization_level, parallel_execution } = self;
if let Some(num_threads) = inter_threads {
session = session.with_inter_threads(num_threads)?;
Expand Down
12 changes: 6 additions & 6 deletions rust/lib/src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ pub(crate) trait Env {
async fn symlink_metadata(path: &Path) -> Result<Metadata>;
async fn open(path: &Path) -> Result<Self::File>;
async fn ort_session_run(
session: &ort::Session, input: Array2<i32>,
) -> Result<ort::SessionOutputs>;
session: &ort::session::Session, input: Array2<i32>,
) -> Result<ort::session::SessionOutputs>;
}

pub(crate) enum SyncEnv {}
Expand All @@ -55,8 +55,8 @@ impl Env for SyncEnv {
}

async fn ort_session_run(
session: &ort::Session, input: Array2<i32>,
) -> Result<ort::SessionOutputs> {
session: &ort::session::Session, input: Array2<i32>,
) -> Result<ort::session::SessionOutputs> {
Ok(session.run(ort::inputs!("bytes" => input)?)?)
}
}
Expand All @@ -74,8 +74,8 @@ impl Env for AsyncEnv {
}

async fn ort_session_run(
session: &ort::Session, input: Array2<i32>,
) -> Result<ort::SessionOutputs> {
session: &ort::session::Session, input: Array2<i32>,
) -> Result<ort::session::SessionOutputs> {
Ok(session.run_async(ort::inputs!("bytes" => input)?)?.await?)
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust/lib/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{AsyncInput, Builder, Features, FeaturesOrRuled, FileType, Result, Sy
/// A Magika session to identify files.
#[derive(Debug)]
pub struct Session {
pub(crate) session: ort::Session,
pub(crate) session: ort::session::Session,
}

impl Session {
Expand Down
4 changes: 2 additions & 2 deletions rust/onnx/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ else
git clone --recursive https://github.com/Microsoft/onnxruntime.git runtime
cd runtime

info "Checkout v1.19.2 because that's what ort v2.0.0-rc.8 supports."
git checkout v1.19.2
info "Checkout v1.20.0 because that's what ort v2.0.0-rc.9 supports."
git checkout v1.20.0

info "Build the static libraries."
x ./build.sh --config=Release --parallel $ONNX_RUNTIME_BUILD_FLAGS
Expand Down

0 comments on commit ed4e54f

Please sign in to comment.