mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-08 22:52:59 -04:00
sci-misc/llama-cpp: add 0_pre8100
Signed-off-by: Sergey Alirzaev <l29ah@riseup.net>
This commit is contained in:
@@ -6,3 +6,4 @@ DIST llama-cpp-0_pre7611.tar.gz 28622786 BLAKE2B 3c345645c9bcf07d8a513b9e883619b
|
||||
DIST llama-cpp-0_pre7770.tar.gz 28797089 BLAKE2B 0ad614f16c19ff1339571dd90be566ff4ccedfd991dfeb948f0cedc54f8447a3e72e35ac392bb60d5bc8a44d1757be3bea0123eac02b694f5f0a8f2c2b941b6a SHA512 78896fdcf05330bb4b1fd86a985da56882d0166c6f276afda273dca183e4c7365decd5e9630c8d633e065162cbb06d6d8e4fdcf76be9768b238ee5053abaa3aa
|
||||
DIST llama-cpp-0_pre7836.tar.gz 28813563 BLAKE2B c843c0199b528114c23c58536552e2a7f581fda93364353e8aa38fda99ddb1942c421ad00be4daf86b49a2c311ef89bb6908b8900ca1ffb64df338cbfa11c354 SHA512 161176107de175d9b6fdc1ebfa9fe0cf6fd6968245730f7df7f17c6a179ef111685d0fed5a45031825dc4b07db270887a4307061f9918e375a1c65f261062d9d
|
||||
DIST llama-cpp-0_pre7924.tar.gz 28899921 BLAKE2B b89c8c170d1c2d52390dfef35a4e0857b4a3aa174077f2fdfa0fbbe1a254c5e6ae9b976bde9f52e42ed3932403aec728b9c415ca44ccd22c061e7e8a1e481526 SHA512 689c73215e795a53be1d0e6a639983aded1ed7bdeb3a261556de3db2cfdc765a7daf4aa142433f5e99a255dc123035a929b57868d3941ddda400a3c2b1db31cb
|
||||
DIST llama-cpp-0_pre8100.tar.gz 29031553 BLAKE2B daa0f439391dd9b0b7804b893d060f11c94600dc4347c0f4d86ede376ef951f725d4811c07b729e6e7bb06cab5e7e6aacc5c3a99b8e6e13ff3e7ed2ae5eae288 SHA512 2582732ee28839d940f5feb66640123070eb0a57f0b6c434fcdca85c84ccabccff430b01c5d361b1b936305b8e9fce9886c6038c44d62e084e6ca9a241533821
|
||||
|
||||
162
sci-misc/llama-cpp/llama-cpp-0_pre8100.ebuild
Normal file
162
sci-misc/llama-cpp/llama-cpp-0_pre8100.ebuild
Normal file
@@ -0,0 +1,162 @@
|
||||
# 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 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:= )
|
||||
"
|
||||
DEPEND="${CDEPEND}
|
||||
opencl? ( dev-util/opencl-headers )
|
||||
vulkan? ( 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)
|
||||
-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"
|
||||
}
|
||||
Reference in New Issue
Block a user