# Copyright 2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # Fine-tune and post-train LLMs from one YAML (LoRA/QLoRA, SFT, DPO and # friends), with GGUF export for serving via LocalAI. Ships upstream's # [train] stack unconditionally — the base CLI cannot fine-tune and is # not worth a flag. Every dependency is a tree or overlay package (no # venv), bitsandbytes included for the 4bit/8bit quantization paths. EAPI=8 DISTUTILS_USE_PEP517=hatchling DISTUTILS_SINGLE_IMPL=1 PYTHON_COMPAT=( python3_{12..14} ) inherit distutils-r1 DESCRIPTION="Fine-tune and post-train LLMs in one command" HOMEPAGE="https://trysoup.dev https://github.com/MakazhanAlpamys/Soup" # The PyPI sdist: releases land there first (GitHub main can lag a # patch release behind). SRC_URI="https://files.pythonhosted.org/packages/source/s/soup-cli/soup_cli-${PV}.tar.gz" S="${WORKDIR}/soup_cli-${PV}" LICENSE="Apache-2.0" SLOT="0" KEYWORDS="~amd64" RESTRICT="test" RDEPEND=" sci-ml/accelerate[${PYTHON_SINGLE_USEDEP}] sci-ml/datasets[${PYTHON_SINGLE_USEDEP}] sci-ml/huggingface_hub[${PYTHON_SINGLE_USEDEP}] sci-ml/pytorch[${PYTHON_SINGLE_USEDEP}] >=sci-ml/transformers-5.16.1[${PYTHON_SINGLE_USEDEP}] dev-python/peft[${PYTHON_SINGLE_USEDEP}] dev-python/trl[${PYTHON_SINGLE_USEDEP}] sci-ml/bitsandbytes[${PYTHON_SINGLE_USEDEP}] $(python_gen_cond_dep ' =0.15.4,<0.21.0",/"typer>=0.15.4",/' pyproject.toml || die grep -q '"typer>=0.15.4",' pyproject.toml || die "typer pin relax did not apply" # Upstream caps requires-python at <3.13 to keep pip users inside its # CI-tested torch-wheel matrix (loader crashes in libc10.so on # untested interpreters, upstream #358). That hazard does not exist # here: sci-ml/pytorch is built from source for the active python. sed -i 's/requires-python = ">=3.10,<3.13"/requires-python = ">=3.10"/' pyproject.toml || die grep -q 'requires-python = ">=3.10"' pyproject.toml || die "requires-python relax did not apply" }