Skip to content

Add batched and pipelined inference for SAM2 #341

Add batched and pipelined inference for SAM2

Add batched and pipelined inference for SAM2 #341

name: test-pip-installation
on:
push:
branches:
- main
- dev
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request: # run CI on commits to any open PR
workflow_dispatch: # can manually trigger CI from GitHub actions tab
jobs:
test-pip:
name: pip-install ubuntu-latest ${{ matrix.python-version }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Setup Qt libraries so napari/PyQt5 import cleanly during test collection
- uses: tlambert03/setup-qt-libs@v1
- name: Install dev requirements
run: python -m pip install -r requirements-dev.txt
- name: Install micro-sam via pip (with dependencies)
run: python -m pip install -e .
# MobileSAM (vit_t backend) is not on PyPI; install it from GitHub to keep vit_t coverage.
- name: Install MobileSAM
run: python -m pip install git+https://github.com/ChaoningZhang/MobileSAM.git
# SAM2 (hvit_* backend) is not on PyPI; install it from GitHub to keep SAM2 coverage.
- name: Install SAM2
run: python -m pip install git+https://github.com/facebookresearch/sam2.git
# A standalone mask prompt is build-dependent with the PyPI torch wheels used here;
# MICRO_SAM_SKIP_STANDALONE_MASK_PROMPT skips that single assertion (see the test).
# Set it via GITHUB_ENV so it is exported to the headless-gui step's environment.
- name: Configure test environment
run: echo "MICRO_SAM_SKIP_STANDALONE_MASK_PROMPT=1" >> "$GITHUB_ENV"
- name: Run non-gui tests
uses: aganders3/headless-gui@v2
with:
run: pytest -m "not gui"