Skip to content

Commit

Permalink
feat: tract & candle backends (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 authored Jan 13, 2025
1 parent d5acc5a commit 3345b52
Show file tree
Hide file tree
Showing 22 changed files with 5,252 additions and 2 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/backends.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: 🧩 Backends
on:
workflow_dispatch:
push:
branches:
- 'main'
paths:
- '.github/workflows/backends.yml'
- 'src/**/*.rs'
- 'backends/**/*.rs'
- 'ort-sys/src/lib.rs'
- 'Cargo.toml'
pull_request:
paths:
- '.github/workflows/backends.yml'
- 'src/**/*.rs'
- 'backends/**/*.rs'
- 'ort-sys/src/lib.rs'
- 'Cargo.toml'
env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
jobs:
candle:
name: Candle
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os: ubuntu-latest
- os: macos-15
steps:
- uses: actions/checkout@v4
- name: Install protoc
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update && sudo apt-get install protobuf-compiler -y
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install protobuf
fi
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Run tests
run: |
cargo test --manifest-path backends/candle/Cargo.toml --verbose -- --test-threads 1
tract:
name: Tract
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os: ubuntu-latest
- os: windows-latest
- os: macos-15
steps:
- uses: actions/checkout@v4
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Run tests
run: |
cargo test --manifest-path backends/tract/Cargo.toml --verbose -- --test-threads 1
2 changes: 1 addition & 1 deletion .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Check fmt
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy -p ort --all-targets --workspace --features fetch-models
run: cargo clippy -p ort --all-targets --features fetch-models
coverage:
name: Code coverage
runs-on: ubuntu-24.04
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ default-members = [
'examples/modnet',
'examples/sentence-transformers'
]
exclude = [ 'examples/cudarc' ]
exclude = [
'backends/candle',
'backends/tract',
'examples/cudarc'
]

[package]
name = "ort"
Expand Down
36 changes: 36 additions & 0 deletions backends/candle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "ort-candle"
description = "ort + candle = 🦀 - An alternative backend for ort, powered by candle."
version = "0.1.0+0.8.1"
edition = "2021"
rust-version = "1.70"
license = "MIT OR Apache-2.0"
repository = "https://github.com/pykeio/ort"
homepage = "https://ort.pyke.io/"
keywords = [ "machine-learning", "ai", "ml" , "sys"]
categories = [ "algorithms", "mathematics", "science" ]
authors = [
"pyke.io <[email protected]>"
]

[lib]
name = "ort_candle"
path = "lib.rs"

[features]

[dependencies]
ort-sys = { version = "=2.0.0-rc.9", path = "../../ort-sys", default-features = false }
candle-core = { version = "0.8.1", default-features = false }
candle-onnx = { version = "0.8.1" }
prost = { version = "0.12.1", default-features = false }

[dev-dependencies]
ort = { version = "=2.0.0-rc.9", path = "../../", default-features = false, features = [ "alternative-backend", "fetch-models" ] }

[[test]]
name = "memory"
path = "tests/memory.rs"
[[test]]
name = "tensor"
path = "tests/tensor.rs"
Loading

0 comments on commit 3345b52

Please sign in to comment.