Skip to content

Commit a7b2b15

Browse files
author
Deploy from CI
committed
Deploy d6db305 to gh-pages
0 parents  commit a7b2b15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+10833
-0
lines changed

.cargo/config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[build]
2+
rustflags = ["-C", "target-cpu=native"]
3+
4+
[target.wasm32-unknown-unknown]
5+
rustflags = ["-C", "target-feature=+simd128"]
6+
7+
[target.x86_64-apple-darwin]
8+
rustflags = ["-C", "target-feature=-avx,-avx2"]

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 5

.github/workflows/book-cd.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy Rust book
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write # To push a branch
12+
pull-requests: write # To create a PR from that branch
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
- name: Install latest mdbook
18+
run: |
19+
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
20+
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
21+
mkdir mdbook
22+
curl -sSL $url | tar -xz --directory=./mdbook
23+
echo `pwd`/mdbook >> $GITHUB_PATH
24+
- name: Deploy GitHub Pages
25+
run: |
26+
# This assumes your book is in the root of your repository.
27+
# Just add a `cd` here if you need to change to another directory.
28+
cd candle-book
29+
mdbook build
30+
git worktree add gh-pages
31+
git config user.name "Deploy from CI"
32+
git config user.email ""
33+
cd gh-pages
34+
# Delete the ref to avoid keeping history.
35+
git update-ref -d refs/heads/gh-pages
36+
rm -rf *
37+
mv ../book/* .
38+
git add .
39+
git commit -m "Deploy $GITHUB_SHA to gh-pages"
40+
git push --force --set-upstream origin gh-pages

.github/workflows/book.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
test:
7+
name: Test candle-book
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write # To push a branch
11+
pull-requests: write # To create a PR from that branch
12+
steps:
13+
- uses: actions/checkout@master
14+
- name: Install Rust
15+
run: |
16+
rustup set profile minimal
17+
rustup toolchain install stable
18+
rustup default stable
19+
- name: Install latest mdbook
20+
run: |
21+
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
22+
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
23+
mkdir bin
24+
curl -sSL $url | tar -xz --directory=bin
25+
echo "$(pwd)/bin" >> $GITHUB_PATH
26+
- name: Run tests
27+
run: cd candle-book && cargo build && mdbook test -L ../target/debug/deps/
28+
29+

.github/workflows/ci_cuda.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI / cuda
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
test-cuda:
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
12+
runs-on:
13+
group: aws-g4dn-2xlarge
14+
container:
15+
image: nvidia/cuda:12.3.1-devel-ubuntu22.04
16+
options: --gpus 0
17+
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
18+
permissions:
19+
contents: write
20+
packages: write
21+
# This is used to complete the identity challenge
22+
# with sigstore/fulcio when running outside of PRs.
23+
id-token: write
24+
security-events: write
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
- name: Install dependencies
29+
run: apt-get update && apt install curl build-essential libssl-dev protobuf-compiler pkg-config -y
30+
- name: Install Rust Stable
31+
uses: actions-rust-lang/setup-rust-toolchain@v1
32+
- uses: Swatinem/rust-cache@v2
33+
- name: Test (cuda)
34+
run: cargo test --features cuda

.github/workflows/maturin.yml

6.52 KB
Binary file not shown.

.github/workflows/python.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: PyO3-CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- candle-pyo3/**
10+
pull_request:
11+
paths:
12+
- candle-pyo3/**
13+
14+
jobs:
15+
build_and_test:
16+
name: Check everything builds & tests
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest] # For now, only test on Linux
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Install Rust
26+
uses: actions-rs/toolchain@v1
27+
with:
28+
toolchain: stable
29+
30+
- name: Install Python
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: 3.11
34+
architecture: "x64"
35+
36+
- name: Cache Cargo Registry
37+
uses: actions/cache@v1
38+
with:
39+
path: ~/.cargo/registry
40+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
41+
42+
- name: Install Protoc
43+
uses: arduino/setup-protoc@v2
44+
with:
45+
version: "25.0"
46+
repo-token: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Install
49+
working-directory: ./candle-pyo3
50+
run: |
51+
python -m venv .env
52+
source .env/bin/activate
53+
pip install -U pip
54+
pip install pytest maturin black
55+
python -m maturin develop -r --features onnx
56+
57+
- name: Check style
58+
working-directory: ./candle-pyo3
59+
run: |
60+
source .env/bin/activate
61+
python stub.py --check
62+
black --check .
63+
64+
- name: Run tests
65+
working-directory: ./candle-pyo3
66+
run: |
67+
source .env/bin/activate
68+
python -m pytest -s -v tests

.github/workflows/rust-ci.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
7+
name: Continuous integration
8+
9+
jobs:
10+
check:
11+
name: Check
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macOS-latest]
16+
rust: [stable]
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.11"
22+
- uses: actions-rs/toolchain@v1
23+
with:
24+
profile: minimal
25+
toolchain: ${{ matrix.rust }}
26+
override: true
27+
- uses: actions-rs/cargo@v1
28+
with:
29+
command: check
30+
args: --workspace
31+
32+
test:
33+
name: Test Suite
34+
runs-on: ${{ matrix.os }}
35+
strategy:
36+
matrix:
37+
os: [ubuntu-latest, windows-latest, macOS-latest]
38+
rust: [stable]
39+
steps:
40+
- name: Delete huge unnecessary tools folder
41+
if: runner.os == 'Linux'
42+
run: rm -rf /opt/hostedtoolcache
43+
- uses: actions/checkout@v4
44+
- uses: actions/setup-python@v5
45+
with:
46+
python-version: "3.11"
47+
- uses: actions-rs/toolchain@v1
48+
with:
49+
profile: minimal
50+
toolchain: ${{ matrix.rust }}
51+
override: true
52+
- uses: actions-rs/cargo@v1
53+
with:
54+
command: test
55+
args: --workspace
56+
57+
fmt:
58+
name: Rustfmt
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
- uses: actions-rs/toolchain@v1
63+
with:
64+
profile: minimal
65+
toolchain: stable
66+
override: true
67+
- run: rustup component add rustfmt
68+
- uses: actions-rs/cargo@v1
69+
with:
70+
command: fmt
71+
args: --all -- --check
72+
73+
clippy:
74+
name: Clippy
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
- uses: actions-rs/toolchain@v1
79+
with:
80+
profile: minimal
81+
toolchain: stable
82+
override: true
83+
- run: rustup component add clippy
84+
- uses: actions-rs/cargo@v1
85+
with:
86+
command: clippy
87+
args: --workspace --tests --examples -- -D warnings

.github/workflows/trufflehog.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
on:
2+
push:
3+
4+
name: Secret Leaks
5+
6+
jobs:
7+
trufflehog:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- name: Secret Scanning
15+
uses: trufflesecurity/trufflehog@main

.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
debug/
4+
data/
5+
dist/
6+
target/
7+
8+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
9+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
10+
Cargo.lock
11+
12+
# editor config
13+
.helix
14+
.vscode
15+
16+
# These are backup files generated by rustfmt
17+
**/*.rs.bk
18+
19+
# MSVC Windows builds of rustc generate these, which store debugging information
20+
*.pdb
21+
22+
*tokenizer*.json
23+
*.npz
24+
25+
perf.data
26+
flamegraph.svg
27+
*.dylib
28+
*.so
29+
*.swp
30+
*.swo
31+
trace-*.json
32+
33+
candle-wasm-examples/*/build
34+
candle-wasm-examples/*/*.bin
35+
candle-wasm-examples/*/*.jpeg
36+
candle-wasm-examples/*/audios/*.wav
37+
candle-wasm-examples/**/*.safetensors
38+
candle-wasm-examples/**/*.gguf
39+
candle-wasm-examples/*/package-lock.json
40+
candle-wasm-examples/**/config*.json
41+
.DS_Store
42+
.idea/*
43+
__pycache__
44+
out.safetensors
45+
out.wav
46+
bria.mp3
47+
bria.safetensors
48+
bria.wav

0 commit comments

Comments
 (0)