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.
This commit is contained in:
Daniel Han 2026-05-07 04:51:52 +00:00
commit df81c35d34

View file

@ -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