Skip to content

Commit 7436d9a

Browse files
committed
Fix CI metallib staging
1 parent 4893c49 commit 7436d9a

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
- name: Download test model from HuggingFace
155155
run: |
156156
mkdir -p models
157-
huggingface-cli download mlx-community/Qwen1.5-0.5B-Chat-4bit --local-dir models/Qwen1.5-0.5B-Chat-4bit
157+
hf download mlx-community/Qwen1.5-0.5B-Chat-4bit --local-dir models/Qwen1.5-0.5B-Chat-4bit --local-dir-use-symlinks False
158158
echo "Model files:"
159159
ls -la models/Qwen1.5-0.5B-Chat-4bit/
160160
@@ -170,6 +170,40 @@ jobs:
170170
name: native-linux-x64
171171
path: artifacts/native/linux-x64
172172

173+
- name: Ensure macOS metallib is available
174+
run: |
175+
set -euo pipefail
176+
177+
metallib_path="artifacts/native/osx-arm64/mlx.metallib"
178+
if [ -f "${metallib_path}" ]; then
179+
echo "Found mlx.metallib in downloaded native artifact."
180+
exit 0
181+
fi
182+
183+
echo "::warning::mlx.metallib missing from native artifact; attempting to source from installed mlx package"
184+
python - <<'PY'
185+
import pathlib
186+
import shutil
187+
import sys
188+
189+
try:
190+
import mlx # type: ignore
191+
except ImportError:
192+
print("::error::The 'mlx' Python package is not installed; cannot locate mlx.metallib.")
193+
sys.exit(1)
194+
195+
src = pathlib.Path(mlx.__file__).resolve().parent / "backend" / "metal" / "kernels" / "mlx.metallib"
196+
dest = pathlib.Path("artifacts/native/osx-arm64/mlx.metallib").resolve()
197+
dest.parent.mkdir(parents=True, exist_ok=True)
198+
199+
if not src.exists():
200+
print(f"::error::Could not find mlx.metallib at {src}")
201+
sys.exit(1)
202+
203+
shutil.copy2(src, dest)
204+
print(f"Copied mlx.metallib from {src} to {dest}")
205+
PY
206+
173207
- name: Stage native libraries in project
174208
run: |
175209
mkdir -p src/MLXSharp/runtimes/osx-arm64/native

0 commit comments

Comments
 (0)