nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1diff --git a/unsloth_zoo/__init__.py b/unsloth_zoo/__init__.py
2index 8c4404c..dc1666f 100644
3--- a/unsloth_zoo/__init__.py
4+++ b/unsloth_zoo/__init__.py
5@@ -90,8 +90,6 @@ if (os.environ.get("UNSLOTH_COMPILE_DEBUG", "0") == "1"):
6
7
8 from importlib.util import find_spec
9-if find_spec("unsloth") is None:
10- raise ImportError("Please install Unsloth via `pip install unsloth`!")
11 if find_spec("torch") is None:
12 raise ImportError(
13 "Unsloth: Pytorch is not installed. Go to https://pytorch.org/.\n"\
14@@ -275,9 +273,6 @@ del remove_expandable_segments, delete_key, IS_HIP_RUNTIME, IS_TORCH_2_9_OR_NEWE
15 del clean_expandable_segments_value
16 del _ORIGINAL_PYTORCH_CUDA_ALLOC_CONF, _ORIGINAL_PYTORCH_HIP_ALLOC_CONF, _HAS_ORIGINAL_PYTORCH_ALLOC_CONF
17
18-if not ("UNSLOTH_IS_PRESENT" in os.environ):
19- raise ImportError("Please install Unsloth via `pip install unsloth`!")
20-
21 try:
22 print("🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.")
23 except:
24diff --git a/unsloth_zoo/device_type.py b/unsloth_zoo/device_type.py
25index 11136fb..8f8dafc 100644
26--- a/unsloth_zoo/device_type.py
27+++ b/unsloth_zoo/device_type.py
28@@ -209,6 +209,9 @@ def get_device_type():
29 return "cuda"
30 elif hasattr(torch, "xpu") and torch.xpu.is_available():
31 return "xpu"
32+ else:
33+ # Allow import during tests
34+ return None
35 # Check torch.accelerator
36 if hasattr(torch, "accelerator"):
37 if not torch.accelerator.is_available():