Commit 81b8490b authored by Hugo Herter's avatar Hugo Herter Committed by Gaetan Lepage
Browse files

python312Packages.unsloth-zoo: init at 2025.4.1

parent 4dfea7e0
Loading
Loading
Loading
Loading
+86 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,

  # build-system
  setuptools,
  setuptools-scm,

  # dependencies
  accelerate,
  cut-cross-entropy,
  datasets,
  hf-transfer,
  huggingface-hub,
  packaging,
  peft,
  psutil,
  sentencepiece,
  torch,
  tqdm,
  transformers,
  trl,
  tyro,
}:

buildPythonPackage rec {
  pname = "unsloth-zoo";
  version = "2025.4.1";
  pyproject = true;

  # no tags on GitHub
  src = fetchPypi {
    pname = "unsloth_zoo";
    inherit version;
    hash = "sha256-mRs/NMCNJWT52S7mtbQI332IQR6+/IaL29XmtMOz3fE=";
  };

  # pyproject.toml requires an obsolete version of protobuf,
  # but it is not used.
  # Upstream issue: https://github.com/unslothai/unsloth-zoo/pull/68
  pythonRelaxDeps = [
    "protobuf"
  ];

  patches = [
    # Avoid circular dependency in Nix, since `unsloth` depends on `unsloth-zoo`.
    ./dont-require-unsloth.patch
  ];

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    accelerate
    cut-cross-entropy
    datasets
    hf-transfer
    huggingface-hub
    packaging
    peft
    psutil
    sentencepiece
    torch
    tqdm
    transformers
    trl
    tyro
  ];

  # No tests
  doCheck = false;

  pythonImportsCheck = [
    "unsloth_zoo"
  ];

  meta = {
    description = "Utils for Unsloth";
    homepage = "https://github.com/unslothai/unsloth_zoo";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ hoh ];
  };
}
+18 −0
Original line number Diff line number Diff line
diff --git a/unsloth_zoo/__init__.py b/unsloth_zoo/__init__.py
--- a/unsloth_zoo/__init__.py
+++ b/unsloth_zoo/__init__.py
@@ -17,14 +17,10 @@
 __version__ = "2025.3.17"
 
 from importlib.util import find_spec
-if find_spec("unsloth") is None:
-    raise ImportError("Please install Unsloth via `pip install unsloth`!")
 pass
 del find_spec
 
 import os
-if not ("UNSLOTH_IS_PRESENT" in os.environ):
-    raise ImportError("Please install Unsloth via `pip install unsloth`!")
 pass
 
 try:
+2 −0
Original line number Diff line number Diff line
@@ -18433,6 +18433,8 @@ self: super: with self; {
  unrpa = callPackage ../development/python-modules/unrpa { };
  unsloth-zoo = callPackage ../development/python-modules/unsloth-zoo { };
  unstructured = callPackage ../development/python-modules/unstructured { };
  unstructured-api-tools = callPackage ../development/python-modules/unstructured-api-tools { };