Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Keep an explicit HF_HUB_ENABLE_HF_TRANSFER and install hf_transfer in Core CI (#12394)

Daniel Hanecb5c4641c86
diff --git a/.github/actions/core-cpu-setup/action.yml b/.github/actions/core-cpu-setup/action.yml
index 4460d1b7cf0..7d3a80854ca 100644
--- a/.github/actions/core-cpu-setup/action.yml
+++ b/.github/actions/core-cpu-setup/action.yml
@@ -161,7 +161,8 @@ runs:
protobuf sentencepiece triton \
psutil packaging tqdm safetensors datasets \
'peft>=0.18,<0.20' 'accelerate>=0.34,<2' \
- ipython
+ ipython hf_transfer
+ # hf_transfer: declared by unsloth and unsloth_zoo, both installed --no-deps; keeps the hub 0.x lane on the user path.
# transformers + trl from the matrix combo.
pip install "$RESOLVED_TRANSFORMERS_SPEC"
pip install "$RESOLVED_TRL_SPEC"
diff --git a/tests/test_synthetic_hf_transfer_gate.py b/tests/test_synthetic_hf_transfer_gate.py
index 3b700daf711..205f8ebd8be 100644
--- a/tests/test_synthetic_hf_transfer_gate.py
+++ b/tests/test_synthetic_hf_transfer_gate.py
@@ -84,3 +84,11 @@ def test_a_spec_less_stub_reads_as_not_installed():
@pytest.mark.parametrize("var", ["HF_HUB_OFFLINE", "TRANSFORMERS_OFFLINE"])
def test_offline_mode_leaves_the_flag_unset_even_when_installed(var):
assert "HF_HUB_ENABLE_HF_TRANSFER" not in _resolve({var: "1"}, _installed)
+
+
[email protected]("value", ["0", "1"])
+def test_an_explicit_value_is_kept_even_when_installed(value):
+ assert (
+ _resolve({"HF_HUB_ENABLE_HF_TRANSFER": value}, _installed)["HF_HUB_ENABLE_HF_TRANSFER"]
+ == value
+ )
diff --git a/unsloth/dataprep/synthetic.py b/unsloth/dataprep/synthetic.py
index 6ef4a59a958..ffb2e9a6229 100644
--- a/unsloth/dataprep/synthetic.py
+++ b/unsloth/dataprep/synthetic.py
@@ -31,8 +31,10 @@ def _hf_transfer_importable() -> bool:
_OFFLINE_VALS = {"1", "true", "yes", "on"}
+# An explicit value is the caller's (Studio sets "0" for its Xet fallback), as in unsloth_zoo.
if (
- not (
+ "HF_HUB_ENABLE_HF_TRANSFER" not in os.environ
+ and not (
os.environ.get("HF_HUB_OFFLINE", "").strip().lower() in _OFFLINE_VALS
or os.environ.get("TRANSFORMERS_OFFLINE", "").strip().lower() in _OFFLINE_VALS
)