Sync model : Granite docling + Idefics3 preprocessing (SmolVLM) #240
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
# Auto-cancel stale runs on the same PR/branch | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
REPO_ID: Qwen/Qwen2-0.5B-Instruct-GGUF | |
MODEL_FILE: qwen2-0_5b-instruct-q8_0.gguf | |
jobs: | |
# Combined job for Linux, Windows, and macOS (non-Metal) | |
build-and-test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Don't cancel other jobs in the matrix if one fails | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-14] | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Cache HuggingFace model | |
id: model-cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/huggingface/hub | |
key: ${{ runner.os }}-model-${{ env.REPO_ID }}-${{ env.MODEL_FILE }} | |
- name: Download model if not cached | |
# Only run this step if the cache was not found | |
if: steps.model-cache.outputs.cache-hit != 'true' | |
run: | | |
pip install huggingface-hub | |
hf download ${{ env.REPO_ID }} ${{ env.MODEL_FILE }} | |
shell: bash | |
- name: Install dependencies | |
env: | |
CMAKE_ARGS: ${{ runner.os == 'macOS' && '-DLLAMA_METAL=off' || '' }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install uv | |
python -m uv pip install -e .[all] --verbose | |
shell: bash | |
- name: Test with pytest | |
run: python -m pytest | |
shell: bash | |
# Dedicated job for macOS with Metal support | |
build-macos-metal: | |
runs-on: macos-14 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
cache: 'pip' | |
- name: System Info | |
run: | | |
uname -a | |
sysctl -n machdep.cpu.brand_string | |
python -c "import platform; print(platform.machine(), platform.architecture())" | |
shell: bash | |
- name: Cache HuggingFace model | |
id: model-cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/huggingface/hub | |
key: ${{ runner.os }}-metal-model-${{ env.REPO_ID }}-${{ env.MODEL_FILE }} | |
- name: Download model if not cached | |
# Only run this step if the cache was not found | |
if: steps.model-cache.outputs.cache-hit != 'true' | |
run: | | |
pip install huggingface-hub | |
hf download ${{ env.REPO_ID }} ${{ env.MODEL_FILE }} | |
shell: bash | |
- name: Install dependencies (macOS Metal) | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install uv | |
CMAKE_ARGS="-DLLAMA_METAL=on -DGGML_METAL_USE_BF16=on -DGGML_METAL_EMBED_LIBRARY=on" python -m uv pip install -e .[all] --verbose | |
shell: bash | |
- name: Test with pytest | |
run: python -m pytest | |
shell: bash |