-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Overhaul ci/run.sh and enable tests with openllama model files #4586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f5f46eb
scripts : add lib.sh and lib_test.sh
crasm 04fee21
scripts : stub out new ci-run.sh script
crasm a34648d
scripts : switch to PascalCase for functions
crasm 9a11611
scripts : add some fancy conversion from snake_case to PascalCase
crasm 6651052
Add venv to ci/run.sh
crasm 09f5d3c
Revert scripts work
crasm 63108cf
scripts : add wrapper script for local use of ci/run.sh
crasm fecdcca
Simplify .gitignore for tests, clang-tidy fixes
crasm 0fddbcf
Label all ctest tests
crasm e7413ce
ci : ctest uses -L main
crasm 86c3eab
Attempt at writing ctest_with_model
crasm d6cf33d
Update test-model-load-cancel
crasm 0e41cc3
ci : add ctest_with_model for debug and release
crasm aa4ebf6
Fix gg_get_model function
crasm 6c459d6
Merge remote-tracking branch 'origin/master' into revamp-ci-run-sh
crasm d8b8ec6
got stuck on CMake
crasm 228f502
Add get_model.cpp to tests/CMakeLists.txt
crasm 4549a6a
Fix README.md output for ctest_with_model
crasm 3e4871a
workflows : use `-L main` for all ctest
crasm 25f1d79
Fixes
crasm 62ca49e
scripts : update usage text for ci-run.sh
crasm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,49 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
| this=$(realpath "$0"); readonly this | ||
| cd "$(dirname "$this")" | ||
| shellcheck "$this" | ||
|
|
||
| if (( $# != 1 && $# != 2 )); then | ||
| cat >&2 <<'EOF' | ||
| usage: | ||
| ci-run.sh <tmp_dir> [<cache_dir>] | ||
|
|
||
| This script wraps ci/run.sh: | ||
| * If <tmp_dir> is a ramdisk, you can reduce writes to your SSD. | ||
| (~30GB per run with openllama_3b_v2) | ||
| * Persistent model and data files are synced to and from <cache_dir>, | ||
| excluding generated .gguf files. | ||
| * <cache_dir> defaults to ~/.cache/llama.cpp | ||
| EOF | ||
| exit 1 | ||
| fi | ||
|
|
||
| cd .. # => llama.cpp repo root | ||
|
|
||
| tmp="$1" | ||
| mkdir -p "$tmp" | ||
| tmp=$(realpath "$tmp") | ||
| echo >&2 "Using tmp=$tmp" | ||
|
|
||
| cache="${2-$HOME/.cache/llama.cpp}" | ||
| mkdir -p "$cache" | ||
| cache=$(realpath "$cache") | ||
| echo >&2 "Using cache=$cache" | ||
|
|
||
| _sync() { | ||
| local from="$1"; shift | ||
| local to="$1"; shift | ||
|
|
||
| echo >&2 "Syncing from $from to $to" | ||
| mkdir -p "$from" "$to" | ||
| rsync -a "$from" "$to" --delete-during "$@" | ||
| } | ||
|
|
||
| _sync "$(realpath .)/" "$tmp/llama.cpp" | ||
| _sync "$cache/ci-mnt/models/" "$tmp/llama.cpp/ci-mnt/models/" | ||
|
|
||
| cd "$tmp/llama.cpp" | ||
| bash ci/run.sh ci-out ci-mnt | ||
|
|
||
| _sync 'ci-mnt/models/' "$cache/ci-mnt/models/" --exclude='*.gguf' -P |
This file contains hidden or 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,2 @@ | ||
| * | ||
| !*.* |
This file contains hidden or 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
This file contains hidden or 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,26 @@ | ||
| #include <cstdio> | ||
| #include <cstdlib> | ||
| #include <cstring> | ||
|
|
||
| #include "get_model.h" | ||
|
|
||
| char * get_model_or_exit(int argc, char *argv[]) { | ||
| char * makelevel = getenv("MAKELEVEL"); | ||
| if (makelevel != nullptr && atoi(makelevel) > 0) { | ||
| fprintf(stderr, "Detected being run in Make. Skipping this test.\n"); | ||
| exit(EXIT_SUCCESS); | ||
| } | ||
|
|
||
| char * model_path; | ||
| if (argc > 1) { | ||
| model_path = argv[1]; | ||
| } else { | ||
| model_path = getenv("GG_RUN_CTEST_MODELFILE"); | ||
| if (!model_path || strlen(model_path) == 0) { | ||
| fprintf(stderr, "error: no model file provided\n"); | ||
| exit(EXIT_FAILURE); | ||
| } | ||
| } | ||
|
|
||
| return model_path; | ||
| } |
This file contains hidden or 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 @@ | ||
| char * get_model_or_exit(int, char*[]); |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.