Skip to content

feat(mlx): Make adamw_8bit actually use 8-bit optimizer state #1777

feat(mlx): Make adamw_8bit actually use 8-bit optimizer state

feat(mlx): Make adamw_8bit actually use 8-bit optimizer state #1777

Workflow file for this run

# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved.
# Build PyPI wheel + sdist, verify content sanity, import-smoke in a clean venv.
# Adapted from unsloth's wheel-smoke.yml; zoo's content checks: package present,
# no tests/ shipped, no stray .pyc, real version string, import smoke succeeds.
name: Wheel CI
on:
pull_request:
paths:
- 'pyproject.toml'
- 'unsloth_zoo/**'
- 'tests/**'
- '.github/workflows/wheel-smoke.yml'
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
wheel:
name: Wheel build + content sanity + import smoke
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Harden runner (audit)
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.12'
- name: Build wheel + sdist
run: |
python -m pip install --upgrade pip build
rm -rf dist build ./*.egg-info
python -m build
- name: Wheel content sanity
run: |
python - <<'PY'
import zipfile, glob, sys, re
wheels = glob.glob("dist/unsloth_zoo-*.whl")
if not wheels:
print("FAIL: no wheel produced"); sys.exit(2)
w = wheels[0]
print(f"wheel: {w}")
# Version sanity: dynamic metadata pulls from unsloth_zoo.__init__.__version__.
m = re.match(r"dist/unsloth_zoo-([^-]+)-py3-none-any\.whl", w)
version = m.group(1) if m else None
print(f"wheel version: {version}")
with zipfile.ZipFile(w) as z:
n = z.namelist()
# Hard checks: must hold for any zoo release wheel.
hard_checks = {
"unsloth_zoo/__init__.py shipped": any(s == "unsloth_zoo/__init__.py" for s in n),
"unsloth_zoo/rl_replacements.py shipped": any(s == "unsloth_zoo/rl_replacements.py" for s in n),
"unsloth_zoo/temporary_patches/__init__.py shipped": any(s == "unsloth_zoo/temporary_patches/__init__.py" for s in n),
"no .pyc files": not any(s.endswith(".pyc") for s in n),
"no .git tree": not any(s.startswith(".git/") for s in n),
"version is not 0.0.0": version is not None and version != "0.0.0",
"METADATA present": any(s.endswith(".dist-info/METADATA") for s in n),
}
# Soft checks (warn only). Zoo's pyproject doesn't exclude tests/scripts;
# tightening the packaging config is a separate follow-up.
soft_checks = {
"no tests/ shipped": not any(s.startswith("tests/") for s in n),
"no scripts/ shipped": not any(s.startswith("scripts/") for s in n),
}
print("Hard checks:")
for k, v in hard_checks.items():
print(f" [{'PASS' if v else 'FAIL'}] {k}")
print()
print("Soft checks (warnings):")
for k, v in soft_checks.items():
status = "PASS" if v else "WARN"
print(f" [{status}] {k}")
# Exit non-zero ONLY if a hard check failed.
sys.exit(0 if all(hard_checks.values()) else 1)
PY
- name: Import smoke (clean venv)
# unsloth_zoo/__init__.py:128 raises ImportError when parent `unsloth` is
# absent (deliberate guardrail). A bare `import unsloth_zoo` in a wheel-only
# venv will fail by design, so the smoke pivots to reading the version
# string from dist-info METADATA via importlib.metadata.
run: |
python -m venv /tmp/v
/tmp/v/bin/pip install --upgrade pip
/tmp/v/bin/pip install dist/unsloth_zoo-*.whl
# Read version from dist-info METADATA via importlib.metadata.
WHEEL_VERSION=$(/tmp/v/bin/python -c "
from importlib.metadata import version
print(version('unsloth_zoo'))
")
echo "installed unsloth_zoo version: $WHEEL_VERSION"
test -n "$WHEEL_VERSION" && test "$WHEEL_VERSION" != "0.0.0"
- name: Upload wheel on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: unsloth-zoo-wheel
path: dist/
retention-days: 7