commit:     bae1c055f8b630258ac378b121070e35d64dc3f2
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 22 08:26:38 2025 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Sat Mar 22 08:27:51 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bae1c055

sci-ml/transformers: with pytorch require accelerate

Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 sci-ml/transformers/metadata.xml                                    | 3 +++
 ...{transformers-4.49.0-r1.ebuild => transformers-4.49.0-r2.ebuild} | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/sci-ml/transformers/metadata.xml b/sci-ml/transformers/metadata.xml
index 9489a5f68f41..fe315dfdbe00 100644
--- a/sci-ml/transformers/metadata.xml
+++ b/sci-ml/transformers/metadata.xml
@@ -5,6 +5,9 @@
                <email>[email protected]</email>
                <name>Tupone Alfredo</name>
        </maintainer>
+       <use>
+               <flag name="torch">Support pytorch</flag>
+       </use>
        <upstream>
                <remote-id type="github">huggingface/transformers</remote-id>
                <remote-id type="pypi">transformers</remote-id>

diff --git a/sci-ml/transformers/transformers-4.49.0-r1.ebuild 
b/sci-ml/transformers/transformers-4.49.0-r2.ebuild
similarity index 96%
rename from sci-ml/transformers/transformers-4.49.0-r1.ebuild
rename to sci-ml/transformers/transformers-4.49.0-r2.ebuild
index a691a7af8f3e..8545ccfe170b 100644
--- a/sci-ml/transformers/transformers-4.49.0-r1.ebuild
+++ b/sci-ml/transformers/transformers-4.49.0-r2.ebuild
@@ -19,6 +19,7 @@ 
SRC_URI="https://github.com/huggingface/${PN}/archive/refs/tags/v${PV}.tar.gz
 LICENSE="Apache-2.0"
 SLOT="0"
 KEYWORDS="~amd64"
+IUSE="torch"
 RESTRICT="test" # Need network, too long to execute
 
 RDEPEND="
@@ -34,6 +35,11 @@ RDEPEND="
                >=sci-ml/huggingface_hub-0.26[${PYTHON_USEDEP}]
                >=sci-ml/safetensors-0.4.1[${PYTHON_USEDEP}]
        ')
+       torch? (
+               sci-ml/pytorch[${PYTHON_SINGLE_USEDEP}]
+               sci-ml/caffe2[${PYTHON_SINGLE_USEDEP}]
+               sci-ml/accelerate[${PYTHON_SINGLE_USEDEP}]
+       )
 "
 BDEPEND="
        $(python_gen_cond_dep '

Reply via email to