-
Notifications
You must be signed in to change notification settings - Fork 947
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Deploy from CI
committed
Nov 3, 2024
0 parents
commit a7e049b
Showing
65 changed files
with
10,695 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[build] | ||
rustflags = ["-C", "target-cpu=native"] | ||
|
||
[target.wasm32-unknown-unknown] | ||
rustflags = ["-C", "target-feature=+simd128"] | ||
|
||
[target.x86_64-apple-darwin] | ||
rustflags = ["-C", "target-feature=-avx,-avx2"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "cargo" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
open-pull-requests-limit: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Deploy Rust book | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # To push a branch | ||
pull-requests: write # To create a PR from that branch | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install latest mdbook | ||
run: | | ||
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') | ||
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" | ||
mkdir mdbook | ||
curl -sSL $url | tar -xz --directory=./mdbook | ||
echo `pwd`/mdbook >> $GITHUB_PATH | ||
- name: Deploy GitHub Pages | ||
run: | | ||
# This assumes your book is in the root of your repository. | ||
# Just add a `cd` here if you need to change to another directory. | ||
cd candle-book | ||
mdbook build | ||
git worktree add gh-pages | ||
git config user.name "Deploy from CI" | ||
git config user.email "" | ||
cd gh-pages | ||
# Delete the ref to avoid keeping history. | ||
git update-ref -d refs/heads/gh-pages | ||
rm -rf * | ||
mv ../book/* . | ||
git add . | ||
git commit -m "Deploy $GITHUB_SHA to gh-pages" | ||
git push --force --set-upstream origin gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Test candle-book | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # To push a branch | ||
pull-requests: write # To create a PR from that branch | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Install Rust | ||
run: | | ||
rustup set profile minimal | ||
rustup toolchain install stable | ||
rustup default stable | ||
- name: Install latest mdbook | ||
run: | | ||
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') | ||
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" | ||
mkdir bin | ||
curl -sSL $url | tar -xz --directory=bin | ||
echo "$(pwd)/bin" >> $GITHUB_PATH | ||
- name: Run tests | ||
run: cd candle-book && cargo build && mdbook test -L ../target/debug/deps/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: CI / cuda | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
jobs: | ||
test-cuda: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
runs-on: | ||
group: aws-g4dn-2xlarge | ||
container: | ||
image: nvidia/cuda:12.3.1-devel-ubuntu22.04 | ||
options: --gpus 0 | ||
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} | ||
permissions: | ||
contents: write | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
security-events: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Install dependencies | ||
run: apt-get update && apt install curl build-essential libssl-dev protobuf-compiler pkg-config -y | ||
- name: Install Rust Stable | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Test (cuda) | ||
run: cargo test --features cuda |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: PyO3-CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- candle-pyo3/** | ||
pull_request: | ||
paths: | ||
- candle-pyo3/** | ||
|
||
jobs: | ||
build_and_test: | ||
name: Check everything builds & tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] # For now, only test on Linux | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
architecture: "x64" | ||
|
||
- name: Cache Cargo Registry | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo/registry | ||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v2 | ||
with: | ||
version: "25.0" | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install | ||
working-directory: ./candle-pyo3 | ||
run: | | ||
python -m venv .env | ||
source .env/bin/activate | ||
pip install -U pip | ||
pip install pytest maturin black | ||
python -m maturin develop -r --features onnx | ||
- name: Check style | ||
working-directory: ./candle-pyo3 | ||
run: | | ||
source .env/bin/activate | ||
python stub.py --check | ||
black --check . | ||
- name: Run tests | ||
working-directory: ./candle-pyo3 | ||
run: | | ||
source .env/bin/activate | ||
python -m pytest -s -v tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
name: Continuous integration | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macOS-latest] | ||
rust: [stable] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --workspace | ||
|
||
test: | ||
name: Test Suite | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macOS-latest] | ||
rust: [stable] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --workspace | ||
|
||
fmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- run: rustup component add rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
clippy: | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- run: rustup component add clippy | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: --workspace --tests --examples -- -D warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
on: | ||
push: | ||
|
||
name: Secret Leaks | ||
|
||
jobs: | ||
trufflehog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Secret Scanning | ||
uses: trufflesecurity/trufflehog@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
data/ | ||
dist/ | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# editor config | ||
.helix | ||
.vscode | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
*tokenizer*.json | ||
*.npz | ||
|
||
perf.data | ||
flamegraph.svg | ||
*.dylib | ||
*.so | ||
*.swp | ||
*.swo | ||
trace-*.json | ||
|
||
candle-wasm-examples/*/build | ||
candle-wasm-examples/*/*.bin | ||
candle-wasm-examples/*/*.jpeg | ||
candle-wasm-examples/*/audios/*.wav | ||
candle-wasm-examples/**/*.safetensors | ||
candle-wasm-examples/**/*.gguf | ||
candle-wasm-examples/*/package-lock.json | ||
candle-wasm-examples/**/config*.json | ||
.DS_Store | ||
.idea/* | ||
__pycache__ | ||
out.safetensors | ||
out.wav | ||
bria.mp3 | ||
bria.safetensors | ||
bria.wav |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "candle-examples/examples/flash-attn/cutlass"] | ||
path = candle-flash-attn/cutlass | ||
url = https://github.com/NVIDIA/cutlass.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
repos: | ||
- repo: https://github.com/Narsil/pre-commit-rust | ||
rev: 2eed6366172ef2a5186e8785ec0e67243d7d73d0 | ||
hooks: | ||
- id: fmt | ||
name: "Rust (fmt)" | ||
- id: clippy | ||
name: "Rust (clippy)" | ||
args: | ||
[ | ||
"--tests", | ||
"--examples", | ||
"--", | ||
"-Dwarnings", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.black-formatter" | ||
}, | ||
"python.formatting.provider": "none", | ||
"python.testing.pytestArgs": [ | ||
"candle-pyo3" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
} |
Oops, something went wrong.