Distribute and run LLMs with a single file.
C++ cross-platformggufllama-cpplocal-ailocal-inferencelocal-llmopen-source-aisingle-file-executablespeech-to-text
#!/bin/bash
# Apply llamafile patches to stable-diffusion.cpp submodule
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SD_DIR="$SCRIPT_DIR/../stable-diffusion.cpp"
PATCHES_DIR="$SCRIPT_DIR/patches"
LLAMAFILE_FILES_DIR="$SCRIPT_DIR/llamafile-files"
cd "$SD_DIR"
# Check if status is dirty, if so, exit
if [ -n "$(git status --porcelain)" ]; then
echo "Git status is dirty. Please commit or stash your changes before applying patches."
exit 1
fi
echo "Applying patches to stable-diffusion.cpp submodule..."
echo "Copying BUILD.mk to root directory..."
cp "$LLAMAFILE_FILES_DIR/BUILD.mk" .
echo "Applying modifications to upstream files..."
for patch_file in "$PATCHES_DIR"/*.patch; do
if [ -f "$patch_file" ]; then
echo "Applying $(basename "$patch_file")..."
patch -p1 < "$patch_file"
fi
done
echo ""
echo "Patches applied successfully!"
echo "Note: These changes are not committed to the submodule."
echo "To reset the submodule to its clean state, run:"
echo " cd stable-diffusion.cpp && git reset --hard && git clean -fdx"