llama.cpp 配置
This commit is contained in:
@@ -30,6 +30,60 @@ generate-bash-completion() {
|
||||
fi
|
||||
}
|
||||
|
||||
load-bash-completion() {
|
||||
local silence=false
|
||||
local -a files=()
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-s)
|
||||
silence=true
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
files+=("$@")
|
||||
break
|
||||
;;
|
||||
*)
|
||||
files+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ${#files[@]} -eq 0 ]]; then
|
||||
echo "usage: load-bash-completion [-s] <path1> [path2 ...]" >&2
|
||||
echo "" >&2
|
||||
echo " -s: if some completion file not exist, just skip it silently" >&2
|
||||
echo "" >&2
|
||||
echo "example: load-bash-completion pnpm npm" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local completion_dir="${HOME}/.local/share/bash-completion/completions"
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
local completion_file="$(realpath -m "${completion_dir}/${file}")"
|
||||
|
||||
if [[ ! -e "$completion_file" ]]; then
|
||||
if [[ "$silence" == false ]]; then
|
||||
echo "WARNING: cannot found completion file '${file}'" >&2
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ ! -r "$completion_file" ]]; then
|
||||
if [[ "$silence" == false ]]; then
|
||||
echo "WARNING: cannot read completion file '$file'" >&2
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
source "$completion_file"
|
||||
done
|
||||
}
|
||||
|
||||
add-to-path() {
|
||||
local silence=false
|
||||
local -a dirs=()
|
||||
|
||||
13
dot/.bashrc.d/llama-cpp.bash
Normal file
13
dot/.bashrc.d/llama-cpp.bash
Normal file
@@ -0,0 +1,13 @@
|
||||
basedir=$(realpath -m $(dirname "${BASH_SOURCE[0]:-$0}"))
|
||||
source "${basedir}/function.bash"
|
||||
|
||||
unset basedir
|
||||
|
||||
if [[ -e "$(type -p llama-cli)" ]]; then
|
||||
completion_file="llama-cpp"
|
||||
|
||||
generate-bash-completion "$completion_file" "llama-cli --completion-bash"
|
||||
load-bash-completion -s "$completion_file"
|
||||
|
||||
unset completion_file
|
||||
fi
|
||||
@@ -43,3 +43,9 @@ app-office/wps-office ~amd64
|
||||
|
||||
# rustup
|
||||
dev-util/rustup ~amd64
|
||||
|
||||
# llama-cpp
|
||||
sci-ml/llama-cpp **
|
||||
|
||||
# nvidia cuda toolkit
|
||||
dev-util/nvidia-cuda-toolkit ~amd64
|
||||
|
||||
@@ -120,3 +120,7 @@ media-libs/freetype harfbuzz
|
||||
|
||||
# watchman
|
||||
dev-cpp/glog gflags
|
||||
|
||||
# llama-cpp
|
||||
sci-libs/openblas cpudetection
|
||||
sci-ml/llama-cpp cuda flexiblas opencl rpc vulkan
|
||||
|
||||
Reference in New Issue
Block a user