Skip to content

Make the shell scripts cross-platform #14341

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devops/tools.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

# Read the first argument into a variable
Expand Down
2 changes: 1 addition & 1 deletion build-xcframework.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Options
IOS_MIN_OS_VERSION=16.4
Expand Down
2 changes: 1 addition & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# sample usage:
#
Expand Down
2 changes: 1 addition & 1 deletion examples/Miku.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

AI_NAME="${AI_NAME:-Miku}"
Expand Down
2 changes: 1 addition & 1 deletion examples/chat-13B.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion examples/chat-persistent.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -euo pipefail

Expand Down
2 changes: 1 addition & 1 deletion examples/chat-vicuna.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion examples/chat.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#
# Temporary script - will be removed in the future
Expand Down
2 changes: 1 addition & 1 deletion examples/jeopardy/jeopardy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

MODEL=./models/ggml-vicuna-13b-1.1-q4_0.bin
Expand Down
2 changes: 1 addition & 1 deletion examples/reason-act.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

cd `dirname $0`
cd ..
Expand Down
2 changes: 1 addition & 1 deletion examples/server-llama2-13B.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion examples/sycl/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#!/bin/sh
# MIT license
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: MIT
Expand Down
2 changes: 1 addition & 1 deletion examples/sycl/run-llama2.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# MIT license
# Copyright (C) 2024 Intel Corporation
Expand Down
2 changes: 1 addition & 1 deletion examples/sycl/run-llama3.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# MIT license
# Copyright (C) 2025 Intel Corporation
Expand Down
2 changes: 1 addition & 1 deletion examples/ts-type-to-grammar.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# ./examples/ts-type-to-grammar.sh "{a:string,b:string,c?:string}"
# python examples/json_schema_to_grammar.py https://json.schemastore.org/tsconfig.json
Expand Down
2 changes: 1 addition & 1 deletion scripts/apple/validate-apps.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
./scripts/apple/validate-ios.sh
./scripts/apple/validate-macos.sh
./scripts/apple/validate-visionos.sh
Expand Down
2 changes: 1 addition & 1 deletion scripts/apple/validate-ios.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# validate-ios.sh - Validate iOS Application with embedded llama.xcframework using SwiftUI

# Authentication options (optional) (can be set via environment variables)
Expand Down
2 changes: 1 addition & 1 deletion scripts/apple/validate-macos.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# validate-macos.sh - Validate macOS Application with embedded llama.xcframework using SwiftUI

# Authentication options (optional) (can be set via environment variables)
Expand Down
2 changes: 1 addition & 1 deletion scripts/apple/validate-tvos.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# validate-tvos.sh - Validate tvOS Application with embedded llama.xcframework using SwiftUI

# Authentication options (optional) (can be set via environment variables)
Expand Down
2 changes: 1 addition & 1 deletion scripts/apple/validate-visionos.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# validate-visionos.sh - Validate visionOS Application with embedded llama.xcframework using SwiftUI

# Authentication options (optional) (can be set via environment variables)
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-requirements.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -euo pipefail

#
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci-run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -euo pipefail
this=$(realpath "$0"); readonly this
cd "$(dirname "$this")"
Expand Down
2 changes: 1 addition & 1 deletion scripts/compare-commits.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

if [ $# -lt 2 ]; then
echo "usage: ./scripts/compare-commits.sh <commit1> <commit2> [additional llama-bench arguments]"
Expand Down
2 changes: 1 addition & 1 deletion scripts/debug-test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

PROG=${0##*/}
build_dir="build-ci-debug"
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen-authors.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

printf "# date: $(date)\n" > AUTHORS
printf "# this file is auto-generated by scripts/gen-authors.sh\n\n" >> AUTHORS
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-hellaswag.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

wget https://raw.githubusercontent.com/klosax/hellaswag_text_data/main/hellaswag_val_full.txt

Expand Down
2 changes: 1 addition & 1 deletion scripts/get-pg.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

function usage {
echo "usage: <n>$0"
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-wikitext-103.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

wget https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-103-raw-v1.zip

Expand Down
2 changes: 1 addition & 1 deletion scripts/get-wikitext-2.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

wget https://huggingface.co/datasets/ggml-org/ci/resolve/main/wikitext-2-raw-v1.zip
unzip wikitext-2-raw-v1.zip
Expand Down
2 changes: 1 addition & 1 deletion scripts/get-winogrande.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

wget https://huggingface.co/datasets/ikawrakow/winogrande-eval-for-llama.cpp/raw/main/winogrande-debiased-eval.csv

Expand Down
2 changes: 1 addition & 1 deletion scripts/hf.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Shortcut for downloading HF models
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/qnt-all.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

qnt=(q8_0 q6_k q5_k q5_1 q5_0 q4_k q4_1 q4_0 q3_k q2_k)
args=""
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-all-perf.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

qnt=(f16 q8_0 q6_k q5_k q5_1 q5_0 q4_k q4_1 q4_0 q3_k q2_k)
args="-ngl 999 -n 64 -p 512"
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-all-ppl.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

qnt=(f16 q8_0 q6_k q5_k q5_1 q5_0 q4_k q4_1 q4_0 q3_k q2_k)
args="-ngl 999 -t 8"
Expand Down
2 changes: 1 addition & 1 deletion scripts/sync-ggml-am.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Synchronize ggml changes to llama.cpp
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/sync-ggml.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

cp -rpv ../ggml/CMakeLists.txt ./ggml/CMakeLists.txt
cp -rpv ../ggml/src/CMakeLists.txt ./ggml/src/CMakeLists.txt
Expand Down
2 changes: 1 addition & 1 deletion scripts/tool_bench.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -euo pipefail

cmake --build build -j
Expand Down
2 changes: 1 addition & 1 deletion tests/test-lora-conversion-inference.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

# Array of models to iterate over
Expand Down
2 changes: 1 addition & 1 deletion tests/test-tokenizer-0.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Usage:
#
Expand Down
2 changes: 1 addition & 1 deletion tests/test-tokenizers-repo.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

if [ $# -lt 2 ]; then
printf "Usage: $0 <git-repo> <target-folder> [<test-exe>]\n"
Expand Down
2 changes: 1 addition & 1 deletion tools/gguf-split/tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -eu

Expand Down
2 changes: 1 addition & 1 deletion tools/mtmd/tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# make sure we are in the right directory
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
Expand Down
2 changes: 1 addition & 1 deletion tools/quantize/tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -eu

Expand Down
2 changes: 1 addition & 1 deletion tools/server/chat-llama2.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

API_URL="${API_URL:-http://127.0.0.1:8080}"

Expand Down
2 changes: 1 addition & 1 deletion tools/server/chat.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

API_URL="${API_URL:-http://127.0.0.1:8080}"

Expand Down
2 changes: 1 addition & 1 deletion tools/server/tests/tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# make sure we are in the right directory
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
Expand Down