Unverified Commit 735d2d57 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

python312Packages.sentence-transformers: add optional-dependencies (#371955)

parents f66b5152 7e93c30e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ python312.pkgs.buildPythonApplication rec {
      requests
      restrictedpython
      sentence-transformers
      sentencepiece
      soundfile
      tiktoken
      transformers
+20 −12
Original line number Diff line number Diff line
@@ -2,14 +2,17 @@
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,

  # build-system
  setuptools,

  # dependencies
  accelerate,
  datasets,
  huggingface-hub,
  nltk,
  numpy,
  optimum,
  pillow,
  scikit-learn,
  scipy,
  sentencepiece,
@@ -19,8 +22,6 @@
  transformers,

  # tests
  accelerate,
  datasets,
  pytestCheckHook,
  pytest-cov-stub,
}:
@@ -30,6 +31,8 @@ buildPythonPackage rec {
  version = "3.4.1";
  pyproject = true;

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "UKPLab";
    repo = "sentence-transformers";
@@ -41,23 +44,28 @@ buildPythonPackage rec {

  dependencies = [
    huggingface-hub
    nltk
    numpy
    pillow
    scikit-learn
    scipy
    sentencepiece
    tokenizers
    torch
    tqdm
    transformers
  ];

  nativeCheckInputs = [
  optional-dependencies = {
    train = [
      accelerate
      datasets
    pytestCheckHook
    pytest-cov-stub
    ];
    onnx = [ optimum ] ++ optimum.optional-dependencies.onnxruntime;
    # onnx-gpu = [ optimum ] ++ optimum.optional-dependencies.onnxruntime-gpu;
    # openvino = [ optimum-intel ] ++ optimum-intel.optional-dependencies.openvino;
  };

  nativeCheckInputs = [
    pytest-cov-stub
    pytestCheckHook
  ] ++ lib.flatten (builtins.attrValues optional-dependencies);

  pythonImportsCheck = [ "sentence_transformers" ];