From df81c35d347a8c14b74ca4efdee0b90441e86686 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 7 May 2026 04:51:52 +0000 Subject: [PATCH] CI(consolidated): set UNSLOTH_IS_PRESENT=1 so unsloth_zoo.__init__ accepts the bootstrap Run #5 surfaced 6 collection errors in unsloth_zoo's tests/ that import unsloth_zoo.saving_utils or unsloth_zoo.temporary_patches at module scope. unsloth_zoo/__init__.py:314 raises ImportError("Please install Unsloth via pip install unsloth!") unless UNSLOTH_IS_PRESENT is in os.environ. Normally unsloth.__init__ sets that env var when unsloth is imported first. In this job we go through the unsloth_zoo conftest device_type spoof first (which loads device_type standalone, never running unsloth_zoo.__init__), then later imports of unsloth_zoo.saving_utils trigger the real __init__ without the env var. Fix: set UNSLOTH_IS_PRESENT=1 at the job-level env block. Has no effect on unsloth itself. --- .github/workflows/consolidated-tests-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/consolidated-tests-ci.yml b/.github/workflows/consolidated-tests-ci.yml index 4e31f7804e..350d1ee400 100644 --- a/.github/workflows/consolidated-tests-ci.yml +++ b/.github/workflows/consolidated-tests-ci.yml @@ -69,6 +69,13 @@ jobs: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python PYTHONPATH: ${{ github.workspace }}/studio UNSLOTH_COMPILE_DISABLE: '1' + # unsloth_zoo/__init__.py:314 raises ImportError unless UNSLOTH_IS_PRESENT + # is set — normally it is set by unsloth.__init__ when unsloth is imported + # first. In this job we sometimes import unsloth_zoo.* (e.g. + # unsloth_zoo.saving_utils, unsloth_zoo.temporary_patches) without going + # through `import unsloth` first; pin the env var to 1 so unsloth_zoo's + # bootstrap accepts it. Setting it has no effect on unsloth itself. + UNSLOTH_IS_PRESENT: '1' steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1