Add latest llama.cpp package
This commit is contained in:
parent
18ec822da4
commit
1e80f12a05
3
sci-misc/llama-cpp/Manifest
Normal file
3
sci-misc/llama-cpp/Manifest
Normal file
@ -0,0 +1,3 @@
|
||||
DIST ggml-org_models_tinyllamas_stories15M-q4_0-99dd1a73db5a37100bd4ae633f4cfce6560e1567.gguf 19077344 SHA256 6151b1929d7f5aa3385d9ddef3393e55587c0a55de661562322bc51dfda93a04 SHA512 f9944886089958e0d97b1906cfd45020e0821c65429346e76fae29136c634ae5d039dffbae5933a95b0674f4acd87b656feb9f9e1b16dd434c5c9b5886f4f617 WHIRLPOOL 16d7f91e83fd02c9e9a9babb8d21e4162834d11b462da2131b816386f8a9bf0012ae7b4e6a315734cb2683208d29f6f1f3da7c1deca5c405cfa28347e3f0ff1d
|
||||
DIST llama-cpp-0_pre9763.tar.gz 34971715 SHA256 31c10b6ca19f6e02fc5557721da3085b512c0a9af1707f7843a9f882fddbe49c SHA512 d33dcfca09603a426db084e89d5e8bf65d2af8eec3f73b7300cdd4a93df1716c1974df3a4abddc9a627202a245e9be982a3111a0725bb5898b41bf9270c240ac WHIRLPOOL c9e69e29fd3563b1e691f082b611369aa4781a6d91c589e13584c144006d2d8523773e74dcf1b0c5a28e14f07316dd0a4346b42194e780cc63bc65b802a77bd6
|
||||
EBUILD llama-cpp-0_pre9763.ebuild 3827 SHA256 f83eb725a5d1f8c8313b1a6fdf72ad893bd1bf93f7ea64c15c620d71f4ef68f3 SHA512 0ddee1d9c023966730592c563d9ee70ce7cf080aa65754d28efc518bc5d1ac333b3599351858ecb9e9a18d4ab8a0c84d8c02f80dc21c291c08c4ac1e022c2384 WHIRLPOOL 6e243f01ed039b7fc3c5f8f53101d364c9d2fbd6f29b58b003348c2e53725ad70c8b38326620c606723f287751461c3ad0e71debee1fc9cf2ff41a15eb71419f
|
||||
167
sci-misc/llama-cpp/llama-cpp-0_pre9763.ebuild
Normal file
167
sci-misc/llama-cpp/llama-cpp-0_pre9763.ebuild
Normal file
@ -0,0 +1,167 @@
|
||||
# Copyright 2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
ROCM_VERSION="6.3"
|
||||
|
||||
inherit cmake cuda rocm linux-info
|
||||
|
||||
TINY_LLAMAS_COMMIT="99dd1a73db5a37100bd4ae633f4cfce6560e1567"
|
||||
|
||||
DESCRIPTION="Port of Facebook's LLaMA model in C/C++"
|
||||
HOMEPAGE="https://github.com/ggml-org/llama.cpp"
|
||||
|
||||
if [[ ${PV} == *9999* ]]; then
|
||||
inherit git-r3
|
||||
EGIT_REPO_URI="https://github.com/ggml-org/llama.cpp.git"
|
||||
else
|
||||
MY_PV="b${PV#0_pre}"
|
||||
SRC_URI="https://github.com/ggml-org/llama.cpp/archive/refs/tags/${MY_PV}.tar.gz -> ${P}.tar.gz"
|
||||
S="${WORKDIR}/llama.cpp-${MY_PV}"
|
||||
KEYWORDS="~amd64"
|
||||
fi
|
||||
|
||||
SRC_URI+="
|
||||
examples? (
|
||||
https://huggingface.co/ggml-org/tiny-llamas/resolve/${TINY_LLAMAS_COMMIT}/stories15M-q4_0.gguf
|
||||
-> ggml-org_models_tinyllamas_stories15M-q4_0-${TINY_LLAMAS_COMMIT}.gguf
|
||||
)
|
||||
"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
CPU_FLAGS_X86=( avx avx2 f16c )
|
||||
|
||||
# wwma USE explained here: https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md#hip
|
||||
IUSE="curl openblas +openmp blis rocm cuda opencl openssl vulkan flexiblas wmma examples"
|
||||
|
||||
REQUIRED_USE="
|
||||
?? (
|
||||
openblas
|
||||
blis
|
||||
flexiblas
|
||||
)
|
||||
wmma? (
|
||||
rocm
|
||||
)
|
||||
"
|
||||
|
||||
# curl is needed for pulling models from huggingface
|
||||
# numpy is used by convert_hf_to_gguf.py
|
||||
CDEPEND="
|
||||
curl? ( net-misc/curl:= )
|
||||
openblas? ( sci-libs/openblas:= )
|
||||
openmp? ( llvm-runtimes/openmp:= )
|
||||
blis? ( sci-libs/blis:= )
|
||||
flexiblas? ( sci-libs/flexiblas:= )
|
||||
rocm? (
|
||||
>=dev-util/hip-${ROCM_VERSION}:=
|
||||
>=sci-libs/hipBLAS-${ROCM_VERSION}:=
|
||||
wmma? (
|
||||
>=sci-libs/rocWMMA-${ROCM_VERSION}:=
|
||||
)
|
||||
)
|
||||
cuda? ( dev-util/nvidia-cuda-toolkit:= )
|
||||
openssl? ( dev-libs/openssl:= )
|
||||
"
|
||||
DEPEND="${CDEPEND}
|
||||
opencl? ( dev-util/opencl-headers )
|
||||
vulkan? (
|
||||
dev-util/spirv-headers
|
||||
dev-util/vulkan-headers
|
||||
)
|
||||
"
|
||||
RDEPEND="${CDEPEND}
|
||||
dev-python/numpy
|
||||
opencl? ( dev-libs/opencl-icd-loader )
|
||||
vulkan? ( media-libs/vulkan-loader )
|
||||
"
|
||||
BDEPEND="media-libs/shaderc"
|
||||
|
||||
pkg_setup() {
|
||||
if use rocm; then
|
||||
linux-info_pkg_setup
|
||||
if linux-info_get_any_version && linux_config_exists; then
|
||||
if ! linux_chkconfig_present HSA_AMD_SVM; then
|
||||
ewarn "To use ROCm/HIP, you need to have HSA_AMD_SVM option enabled in your kernel."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
use cuda && cuda_src_prepare
|
||||
cmake_src_prepare
|
||||
if use examples; then
|
||||
mkdir -p "${BUILD_DIR}/tinyllamas" || die
|
||||
cp "${DISTDIR}/ggml-org_models_tinyllamas_stories15M-q4_0-${TINY_LLAMAS_COMMIT}.gguf" \
|
||||
"${BUILD_DIR}/tinyllamas/stories15M-q4_0.gguf" || die
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local mycmakeargs=(
|
||||
-DLLAMA_BUILD_TESTS=OFF
|
||||
-DLLAMA_BUILD_EXAMPLES=$(usex examples)
|
||||
-DLLAMA_BUILD_SERVER=ON
|
||||
-DCMAKE_SKIP_BUILD_RPATH=ON
|
||||
-DGGML_NATIVE=0 # don't set march
|
||||
-DGGML_RPC=ON
|
||||
-DLLAMA_CURL=$(usex curl)
|
||||
-DLLAMA_OPENSSL=$(usex openssl)
|
||||
-DBUILD_NUMBER="1"
|
||||
-DGENTOO_REMOVE_CMAKE_BLAS_HACK=ON
|
||||
-DGGML_CUDA=$(usex cuda)
|
||||
-DGGML_OPENCL=$(usex opencl)
|
||||
-DGGML_OPENMP=$(usex openmp)
|
||||
-DGGML_VULKAN=$(usex vulkan)
|
||||
|
||||
# avoid clashing with whisper.cpp
|
||||
-DCMAKE_INSTALL_LIBDIR="${EPREFIX}/usr/$(get_libdir)/llama.cpp"
|
||||
-DCMAKE_INSTALL_RPATH="${EPREFIX}/usr/$(get_libdir)/llama.cpp"
|
||||
)
|
||||
|
||||
if use openblas ; then
|
||||
mycmakeargs+=(
|
||||
-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
|
||||
)
|
||||
fi
|
||||
|
||||
if use blis ; then
|
||||
mycmakeargs+=(
|
||||
-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=FLAME
|
||||
)
|
||||
fi
|
||||
|
||||
if use flexiblas; then
|
||||
mycmakeargs+=(
|
||||
-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=FlexiBLAS
|
||||
)
|
||||
fi
|
||||
|
||||
if use cuda; then
|
||||
local -x CUDAHOSTCXX="$(cuda_gccdir)"
|
||||
# tries to recreate dev symlinks
|
||||
cuda_add_sandbox
|
||||
addpredict "/dev/char/"
|
||||
fi
|
||||
|
||||
if use rocm; then
|
||||
rocm_use_hipcc
|
||||
mycmakeargs+=(
|
||||
-DGGML_HIP=ON -DAMDGPU_TARGETS=$(get_amdgpu_flags)
|
||||
-DGGML_HIP_ROCWMMA_FATTN=$(usex wmma)
|
||||
)
|
||||
fi
|
||||
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cmake_src_install
|
||||
dobin "${BUILD_DIR}/bin/rpc-server"
|
||||
|
||||
# avoid clashing with whisper.cpp
|
||||
rm -rf "${ED}/usr/include"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user