#!/bin/bash THIS_DIR="$(cd $(dirname ${BASH_SOURCE}); pwd)" EXLLAMAV2_DIR="$1" PATCH_FILE="${THIS_DIR}/hf.py.patch" main() { if [[ -z "${EXLLAMAV2_DIR}" ]]; then echo "[Usage] $0 EXLLAMAV2_DIR" exit 1 fi if [[ ! -d "${EXLLAMAV2_DIR}" ]]; then echo "[ERROR] EXLLAMAV2_DIR does not exist. (${EXLLAMAV2_DIR})" >&2 exit 1 fi if [[ ! -e "${PATCH_FILE}" ]]; then echo "[ERROR] Patch file not found. (${PATCH_FILE})" >&2 exit 1 fi if ! (cd "${EXLLAMAV2_DIR}" && patch -p1 < "${PATCH_FILE}"); then echo "[ERROR] Failed to apply patch (${PATCH_FILE})" >&2 exit 1 fi } main "$@"