Skip to content

Commit

Permalink
refactor: split out examples into crates
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 committed Oct 22, 2023
1 parent b849ae2 commit eabeb6e
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Check fmt
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --workspace --features fetch-models
run: cargo clippy -p ort --all-targets --workspace --features fetch-models
coverage:
name: Code coverage
runs-on: ubuntu-latest
Expand All @@ -71,8 +71,8 @@ jobs:
run: cargo install cargo-tarpaulin
- name: Generate code coverage
run: |
cargo tarpaulin --features fetch-models --verbose --timeout 120 --out xml
cargo tarpaulin -p ort --features fetch-models --verbose --timeout 120 --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
fail_ci_if_error: false
11 changes: 2 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Run tests
# do not run doctests until rust-lang/cargo#10469 is merged
run: |
cargo test --verbose --lib --features fetch-models
cargo test -p ort --verbose --lib --features fetch-models
cross-compile:
name: Cross-platform compile
runs-on: ${{ matrix.platform.os }}
Expand Down Expand Up @@ -68,16 +68,9 @@ jobs:
$VCINSTALLDIR = Join-Path $VSINSTALLDIR "VC"
$LLVM_ROOT = Join-Path $VCINSTALLDIR "Tools\Llvm\x64"
echo "PATH=$Env:PATH;${LLVM_ROOT}\bin" >> $Env:GITHUB_ENV
- name: Install native dependencies for Linux
if: matrix.platform.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt-get install pkg-config libfreetype6-dev libexpat1-dev libxcb-composite0-dev libssl-dev libx11-dev libfontconfig1-dev
- name: Build/test
uses: houseabsolute/actions-rust-cross@v0
with:
command: ${{ matrix.platform.command }}
target: ${{ matrix.platform.target }}
args: "--features fetch-models"
env:
LC_ALL: C
args: "-p ort --features fetch-models"
19 changes: 10 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
[workspace]
members = ['ort-sys']
members = [
'ort-sys',
'examples/gpt2',
'examples/yolov8'
]
default-members = [
'.',
'examples/gpt2',
'examples/yolov8'
]

[package]
name = "ort"
Expand Down Expand Up @@ -27,10 +36,6 @@ codegen-units = 1
[package.metadata.docs.rs]
features = [ "half", "fetch-models", "copy-dylibs" ]

[[example]]
name = "gpt"
required-features = ["fetch-models"]

[features]
default = [ "half", "download-binaries", "copy-dylibs" ]

Expand Down Expand Up @@ -87,9 +92,5 @@ widestring = { version = "1.0", optional = true }
anyhow = "1.0"
ureq = "2.1"
image = "0.24"
show-image = { version = "0.13", features = [ "image", "raqote" ] }
raqote = { version = "0.8", default-features = false }
test-log = { version = "0.2", default-features = false, features = [ "trace" ] }
tracing-subscriber = { version = "0.3", default-features = false, features = [ "env-filter", "fmt" ] }
tokenizers = { version = ">=0.13.4", default-features = false, features = [ "onig" ] }
rand = "0.8"
16 changes: 16 additions & 0 deletions examples/gpt2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
publish = false
name = "gpt2"
version = "0.0.0"
edition = "2021"

[dependencies]
ort = { path = "../../", features = [ "fetch-models" ] }
ndarray = "0.15"
tokenizers = { version = ">=0.13.4", default-features = false, features = [ "onig" ] }
rand = "0.8"
tracing-subscriber = { version = "0.3", default-features = false, features = [ "env-filter", "fmt" ] }

[features]
load-dynamic = [ "ort/load-dynamic" ]
cuda = [ "ort/cuda" ]
File renamed without changes.
19 changes: 19 additions & 0 deletions examples/yolov8/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
publish = false
name = "yolov8"
version = "0.0.0"
edition = "2021"

[dependencies]
ort = { path = "../../" }
ndarray = "0.15"
tracing-subscriber = { version = "0.3", default-features = false, features = [ "env-filter", "fmt" ] }
image = "0.24"
show-image = { version = "0.13", features = [ "image", "raqote" ] }
raqote = { version = "0.8", default-features = false }
ureq = "2.1"
tracing = "0.1"

[features]
load-dynamic = [ "ort/load-dynamic" ]
cuda = [ "ort/cuda" ]
File renamed without changes.

0 comments on commit eabeb6e

Please sign in to comment.