Loading pkgs/development/python-modules/trl/default.nix +3 −3 Original line number Diff line number Diff line Loading @@ -16,14 +16,14 @@ buildPythonPackage rec { pname = "trl"; version = "0.15.2"; version = "0.17.0"; pyproject = true; src = fetchFromGitHub { owner = "huggingface"; repo = "trl"; tag = "v${version}"; hash = "sha256-HsSmFXFqDOWVLa6VXdPZVS9C3bjYcsliR0TwNpPiQx4="; hash = "sha256-kRZhtrKGNTJ9TJypRG9dABNn00w77dwx+JxT+2PUrfY="; }; build-system = [ Loading @@ -46,7 +46,7 @@ buildPythonPackage rec { meta = { description = "Train transformer language models with reinforcement learning"; homepage = "https://github.com/huggingface/trl"; changelog = "https://github.com/huggingface/trl/releases/tag/v${version}"; changelog = "https://github.com/huggingface/trl/releases/tag/${src.tag}"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ hoh ]; }; Loading pkgs/development/python-modules/unsloth-zoo/default.nix +5 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ datasets, hf-transfer, huggingface-hub, msgspec, packaging, peft, psutil, Loading @@ -26,14 +27,14 @@ buildPythonPackage rec { pname = "unsloth-zoo"; version = "2025.4.1"; version = "2025.5.11"; pyproject = true; # no tags on GitHub src = fetchPypi { pname = "unsloth_zoo"; inherit version; hash = "sha256-mRs/NMCNJWT52S7mtbQI332IQR6+/IaL29XmtMOz3fE="; hash = "sha256-QRKcFkNlr7pICEy3il+za6hDYjvsSxHIBM6VaB1c5mk="; }; # pyproject.toml requires an obsolete version of protobuf, Loading @@ -41,6 +42,7 @@ buildPythonPackage rec { # Upstream issue: https://github.com/unslothai/unsloth-zoo/pull/68 pythonRelaxDeps = [ "protobuf" "transformers" ]; patches = [ Loading @@ -59,6 +61,7 @@ buildPythonPackage rec { datasets hf-transfer huggingface-hub msgspec packaging peft psutil Loading pkgs/development/python-modules/unsloth-zoo/dont-require-unsloth.patch +14 −2 Original line number Diff line number Diff line diff --git a/unsloth_zoo/__init__.py b/unsloth_zoo/__init__.py index a629854..06014b1 100644 --- a/unsloth_zoo/__init__.py +++ b/unsloth_zoo/__init__.py @@ -17,14 +17,10 @@ __version__ = "2025.3.17" @@ -17,8 +17,6 @@ __version__ = "2025.5.11" from importlib.util import find_spec -if find_spec("unsloth") is None: Loading @@ -10,6 +11,17 @@ diff --git a/unsloth_zoo/__init__.py b/unsloth_zoo/__init__.py pass del find_spec @@ -28,13 +26,14 @@ def get_device_type(): return "cuda" elif hasattr(torch, "xpu") and torch.xpu.is_available(): return "xpu" + else: + # Allow import during tests + return None raise NotImplementedError("Unsloth currently only works on NVIDIA GPUs and Intel GPUs.") pass DEVICE_TYPE : str = get_device_type() import os -if not ("UNSLOTH_IS_PRESENT" in os.environ): - raise ImportError("Please install Unsloth via `pip install unsloth`!") Loading pkgs/development/python-modules/unsloth/default.nix +3 −2 Original line number Diff line number Diff line Loading @@ -31,14 +31,14 @@ buildPythonPackage rec { pname = "unsloth"; version = "2025.4.1"; version = "2025.5.9"; pyproject = true; # Tags on the GitHub repo don't match src = fetchPypi { pname = "unsloth"; inherit version; hash = "sha256-9LtDGfdWH7R3U/xi+aK3V4zA+vs83S6Cp0F2NQKvSdY="; hash = "sha256-ud4+6BmyNvtvJz56dhS9SIXxTDw740rSfxxoi5itw4U="; }; build-system = [ Loading Loading @@ -73,6 +73,7 @@ buildPythonPackage rec { # Upstream issue: https://github.com/unslothai/unsloth-zoo/pull/68 pythonRelaxDeps = [ "protobuf" "transformers" ]; # The source repository contains no test Loading Loading
pkgs/development/python-modules/trl/default.nix +3 −3 Original line number Diff line number Diff line Loading @@ -16,14 +16,14 @@ buildPythonPackage rec { pname = "trl"; version = "0.15.2"; version = "0.17.0"; pyproject = true; src = fetchFromGitHub { owner = "huggingface"; repo = "trl"; tag = "v${version}"; hash = "sha256-HsSmFXFqDOWVLa6VXdPZVS9C3bjYcsliR0TwNpPiQx4="; hash = "sha256-kRZhtrKGNTJ9TJypRG9dABNn00w77dwx+JxT+2PUrfY="; }; build-system = [ Loading @@ -46,7 +46,7 @@ buildPythonPackage rec { meta = { description = "Train transformer language models with reinforcement learning"; homepage = "https://github.com/huggingface/trl"; changelog = "https://github.com/huggingface/trl/releases/tag/v${version}"; changelog = "https://github.com/huggingface/trl/releases/tag/${src.tag}"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ hoh ]; }; Loading
pkgs/development/python-modules/unsloth-zoo/default.nix +5 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ datasets, hf-transfer, huggingface-hub, msgspec, packaging, peft, psutil, Loading @@ -26,14 +27,14 @@ buildPythonPackage rec { pname = "unsloth-zoo"; version = "2025.4.1"; version = "2025.5.11"; pyproject = true; # no tags on GitHub src = fetchPypi { pname = "unsloth_zoo"; inherit version; hash = "sha256-mRs/NMCNJWT52S7mtbQI332IQR6+/IaL29XmtMOz3fE="; hash = "sha256-QRKcFkNlr7pICEy3il+za6hDYjvsSxHIBM6VaB1c5mk="; }; # pyproject.toml requires an obsolete version of protobuf, Loading @@ -41,6 +42,7 @@ buildPythonPackage rec { # Upstream issue: https://github.com/unslothai/unsloth-zoo/pull/68 pythonRelaxDeps = [ "protobuf" "transformers" ]; patches = [ Loading @@ -59,6 +61,7 @@ buildPythonPackage rec { datasets hf-transfer huggingface-hub msgspec packaging peft psutil Loading
pkgs/development/python-modules/unsloth-zoo/dont-require-unsloth.patch +14 −2 Original line number Diff line number Diff line diff --git a/unsloth_zoo/__init__.py b/unsloth_zoo/__init__.py index a629854..06014b1 100644 --- a/unsloth_zoo/__init__.py +++ b/unsloth_zoo/__init__.py @@ -17,14 +17,10 @@ __version__ = "2025.3.17" @@ -17,8 +17,6 @@ __version__ = "2025.5.11" from importlib.util import find_spec -if find_spec("unsloth") is None: Loading @@ -10,6 +11,17 @@ diff --git a/unsloth_zoo/__init__.py b/unsloth_zoo/__init__.py pass del find_spec @@ -28,13 +26,14 @@ def get_device_type(): return "cuda" elif hasattr(torch, "xpu") and torch.xpu.is_available(): return "xpu" + else: + # Allow import during tests + return None raise NotImplementedError("Unsloth currently only works on NVIDIA GPUs and Intel GPUs.") pass DEVICE_TYPE : str = get_device_type() import os -if not ("UNSLOTH_IS_PRESENT" in os.environ): - raise ImportError("Please install Unsloth via `pip install unsloth`!") Loading
pkgs/development/python-modules/unsloth/default.nix +3 −2 Original line number Diff line number Diff line Loading @@ -31,14 +31,14 @@ buildPythonPackage rec { pname = "unsloth"; version = "2025.4.1"; version = "2025.5.9"; pyproject = true; # Tags on the GitHub repo don't match src = fetchPypi { pname = "unsloth"; inherit version; hash = "sha256-9LtDGfdWH7R3U/xi+aK3V4zA+vs83S6Cp0F2NQKvSdY="; hash = "sha256-ud4+6BmyNvtvJz56dhS9SIXxTDw740rSfxxoi5itw4U="; }; build-system = [ Loading Loading @@ -73,6 +73,7 @@ buildPythonPackage rec { # Upstream issue: https://github.com/unslothai/unsloth-zoo/pull/68 pythonRelaxDeps = [ "protobuf" "transformers" ]; # The source repository contains no test Loading