Skip to content
Latchkey

Test model fast workflow (microsoft/Olive)

The Test model fast workflow from microsoft/Olive, explained and optimized by Latchkey.

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: microsoft/Olive.github/workflows/test-model-fast.ymlLicense MITView source

What it does

This is the Test model fast workflow from the microsoft/Olive repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
# This job is run as a github action.
# It checks Olive works on random and small models.
name: Test model fast

on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  ubuntu-test-model-fast:
    name: Ubuntu test model fast
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"

      - name: Install dependencies
        run: |
          python -m pip install -r requirements.txt
          python -m pip install -r test/requirements-test-cpu.txt

      - name: Create llama_env and install llama-cpp-python
        run: |
          LLAMA_ENV="$(pwd)/llama_env"
          python -m venv "$LLAMA_ENV"
          "$LLAMA_ENV/bin/pip" install --upgrade pip
          "$LLAMA_ENV/bin/pip" install gguf safetensors llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
          "$LLAMA_ENV/bin/pip" install transformers sentencepiece protobuf tabulate gguf
          git clone --depth=1 --filter=blob:none --sparse https://github.com/ggerganov/llama.cpp.git /tmp/llama_cpp_repo
          git -C /tmp/llama_cpp_repo sparse-checkout set convert_hf_to_gguf.py conversion --skip-checks
          cp /tmp/llama_cpp_repo/convert_hf_to_gguf.py "$LLAMA_ENV/"
          cp -r /tmp/llama_cpp_repo/conversion "$LLAMA_ENV/"

      - name: pip freeze
        run: |
          python -m pip freeze

      - name: Run fast test
        run: |
          python -m pytest -v -s -p no:warnings --disable-warnings --log-cli-level=WARNING test/cli/test_cli_test_model_smoke.py test/cli/test_cli_whisper_smoke.py

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

# This job is run as a github action.
# It checks Olive works on random and small models.
name: Test model fast
 
on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  ubuntu-test-model-fast:
    timeout-minutes: 30
    name: Ubuntu test model fast
    runs-on: latchkey-small
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v4
 
      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: "3.12"
 
      - name: Install dependencies
        run: |
          python -m pip install -r requirements.txt
          python -m pip install -r test/requirements-test-cpu.txt
 
      - name: Create llama_env and install llama-cpp-python
        run: |
          LLAMA_ENV="$(pwd)/llama_env"
          python -m venv "$LLAMA_ENV"
          "$LLAMA_ENV/bin/pip" install --upgrade pip
          "$LLAMA_ENV/bin/pip" install gguf safetensors llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
          "$LLAMA_ENV/bin/pip" install transformers sentencepiece protobuf tabulate gguf
          git clone --depth=1 --filter=blob:none --sparse https://github.com/ggerganov/llama.cpp.git /tmp/llama_cpp_repo
          git -C /tmp/llama_cpp_repo sparse-checkout set convert_hf_to_gguf.py conversion --skip-checks
          cp /tmp/llama_cpp_repo/convert_hf_to_gguf.py "$LLAMA_ENV/"
          cp -r /tmp/llama_cpp_repo/conversion "$LLAMA_ENV/"
 
      - name: pip freeze
        run: |
          python -m pip freeze
 
      - name: Run fast test
        run: |
          python -m pytest -v -s -p no:warnings --disable-warnings --log-cli-level=WARNING test/cli/test_cli_test_model_smoke.py test/cli/test_cli_whisper_smoke.py
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow