Hugging Face Model integration in Superbench #3913
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: Build Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release/* | |
| pull_request: | |
| branches: | |
| - main | |
| - release/* | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| jobs: | |
| docker-build: | |
| name: Docker build ${{ matrix.name }} | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 1200 | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| # Do not cancel sibling image builds when one matrix entry fails. The ROCm | |
| # entries run on self-hosted runners and can fail transiently; we don't | |
| # want a flaky ROCm build to abort all CUDA images. | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: cuda13.0-arm64 | |
| dockerfile: cuda13.0 | |
| tags: superbench/main:cuda13.0-arm64 | |
| platforms: linux/arm64 | |
| runner: [self-hosted, linux/arm64] | |
| build_args: "NUM_MAKE_JOBS=16" | |
| - name: cuda13.0-amd64 | |
| dockerfile: cuda13.0 | |
| tags: superbench/main:cuda13.0-amd64 | |
| platforms: linux/amd64 | |
| runner: [self-hosted, linux/amd64] | |
| build_args: "NUM_MAKE_JOBS=16" | |
| - name: cuda12.9-arm64 | |
| dockerfile: cuda12.9 | |
| tags: superbench/main:cuda12.9-arm64 | |
| platforms: linux/arm64 | |
| runner: [self-hosted, linux/arm64] | |
| build_args: "NUM_MAKE_JOBS=16" | |
| - name: cuda12.9-amd64 | |
| dockerfile: cuda12.9 | |
| tags: superbench/main:cuda12.9-amd64 | |
| platforms: linux/amd64 | |
| runner: [self-hosted, linux/amd64] | |
| build_args: "NUM_MAKE_JOBS=16" | |
| - name: cuda11.1.1 | |
| dockerfile: cuda11.1.1 | |
| tags: superbench/main:cuda11.1.1,superbench/superbench:latest | |
| platforms: linux/amd64 | |
| runner: ubuntu-latest | |
| build_args: "NUM_MAKE_JOBS=8" | |
| # - name: rocm6.2 | |
| # dockerfile: rocm6.2.x | |
| # tags: superbench/main:rocm6.2 | |
| # platforms: linux/amd64 | |
| # runner: [self-hosted, linux/amd64, rocm] | |
| # build_args: "NUM_MAKE_JOBS=16" | |
| - name: rocm6.3 | |
| dockerfile: rocm6.3.x | |
| tags: superbench/main:rocm6.3 | |
| platforms: linux/amd64 | |
| runner: [self-hosted, linux/amd64, rocm] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| with: | |
| submodules: recursive | |
| - name: Free disk space | |
| run: | | |
| mkdir -p /tmp/emptydir | |
| for dir in /usr/share/swift /usr/share/dotnet /usr/local/share/powershell /usr/local/share/chromium /usr/local/lib/android /opt/ghc; do | |
| sudo rsync -a --delete /tmp/emptydir/ ${dir} | |
| done | |
| sudo apt-get clean | |
| sudo docker rmi $(sudo docker images --format "{{.Repository}}:{{.Tag}}" --filter=reference="node" --filter=reference="buildpack-deps") ||: | |
| sudo docker image prune -a --force --filter="label=maintainer=SuperBench" --filter "until=720h" ||: | |
| df -h | |
| - name: Prepare metadata | |
| id: metadata | |
| run: | | |
| TAGS=${{ matrix.tags }} | |
| if [[ "${{ github.event_name }}" == "push" ]] && [[ "${{ github.ref }}" == "refs/heads/release/"* ]]; then | |
| TAGS=$(sed "s/main:/release:${GITHUB_REF##*/}-/g" <<< ${TAGS}) | |
| fi | |
| if [[ "${{ github.event_name }}" == "pull_request" ]] && [[ "${{ github.base_ref }}" == "release/"* ]]; then | |
| TAGS=$(sed "s/main:/release:${GITHUB_BASE_REF##*/}-/g" <<< ${TAGS}) | |
| fi | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| TAGS=$(sed "s/main:/superbench:${GITHUB_REF##*/}-/g" <<< ${TAGS}) | |
| GHCR_TAG=$(cut -d, -f1 <<< ${TAGS} | sed "s#superbench/superbench#ghcr.io/${{ github.repository }}/superbench#g") | |
| TAGS="${TAGS},${GHCR_TAG}" | |
| fi | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| TAGS=$(sed "s/main:/dev:/g" <<< ${TAGS}) | |
| fi | |
| DOCKERFILE=dockerfile/${{ matrix.dockerfile }}.dockerfile | |
| BUILD_ARGS=${{ matrix.build_args }} | |
| if [[ "${{ matrix.extra_args }}" ]]; then | |
| BUILD_ARGS="${BUILD_ARGS} ${{ matrix.extra_args }}" | |
| fi | |
| BUILD_ARGS="${BUILD_ARGS// /'%0A'}" | |
| CACHE_FROM="type=registry,ref=$(cut -d, -f1 <<< ${TAGS})" | |
| CACHE_TO="" | |
| if [[ "${{ github.event_name }}" != "pull_request" ]]; then | |
| CACHE_TO="type=inline,mode=max" | |
| fi | |
| echo "dockerfile=${DOCKERFILE}" >> "$GITHUB_OUTPUT" | |
| echo "build_args=${BUILD_ARGS}" >> "$GITHUB_OUTPUT" | |
| echo "tags=${TAGS}" >> "$GITHUB_OUTPUT" | |
| echo "cache_from=${CACHE_FROM}" >> "$GITHUB_OUTPUT" | |
| echo "cache_to=${CACHE_TO}" >> "$GITHUB_OUTPUT" | |
| - name: Echo build args | |
| run: echo ${{ steps.metadata.outputs.build_args }} | |
| - name: Echo image tag | |
| run: echo ${{ steps.metadata.outputs.tags }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v1 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v1 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v1 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Pull cache image | |
| run: sudo docker pull ${{ steps.metadata.outputs.tags }} | |
| continue-on-error: true | |
| - name: Login to the GitHub Container Registry | |
| uses: docker/login-action@v1 | |
| if: ${{ github.event_name == 'release' }} | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| id: docker_build | |
| uses: docker/build-push-action@v2 | |
| with: | |
| platforms: ${{ matrix.platforms }} | |
| context: . | |
| file: ${{ steps.metadata.outputs.dockerfile }} | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.metadata.outputs.tags }} | |
| cache-from: ${{ steps.metadata.outputs.cache_from }} | |
| cache-to: ${{ steps.metadata.outputs.cache_to }} | |
| build-args: | | |
| ${{ steps.metadata.outputs.build_args }} | |
| labels: | | |
| org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
| org.opencontainers.image.created=${{ github.event.repository.pushed_at }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| - name: Echo image digest | |
| run: echo ${{ steps.docker_build.outputs.digest }} | |
| docker-merge: | |
| needs: docker-build | |
| if: ${{ !cancelled() }} | |
| name: Docker merge ${{ matrix.name }} | |
| runs-on: self-hosted | |
| timeout-minutes: 300 | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: cuda12.9 | |
| tags: superbench/main:cuda12.9 | |
| sources: >- | |
| superbench/main:cuda12.9-amd64 | |
| superbench/main:cuda12.9-arm64 | |
| - name: cuda13.0 | |
| tags: superbench/main:cuda13.0 | |
| sources: >- | |
| superbench/main:cuda13.0-amd64 | |
| superbench/main:cuda13.0-arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Prepare metadata | |
| id: metadata | |
| run: | | |
| TAGS=${{ matrix.tags }} | |
| SOURCES="${{ matrix.sources }}" | |
| if [[ "${{ github.event_name }}" == "push" ]] && [[ "${{ github.ref }}" == "refs/heads/release/"* ]]; then | |
| TAGS=$(sed "s/main:/release:${GITHUB_REF##*/}-/g" <<< ${TAGS}) | |
| SOURCES=$(sed "s/main:/release:${GITHUB_REF##*/}-/g" <<< ${SOURCES}) | |
| fi | |
| if [[ "${{ github.event_name }}" == "pull_request" ]] && [[ "${{ github.base_ref }}" == "release/"* ]]; then | |
| TAGS=$(sed "s/main:/release:${GITHUB_BASE_REF##*/}-/g" <<< ${TAGS}) | |
| SOURCES=$(sed "s/main:/release:${GITHUB_BASE_REF##*/}-/g" <<< ${SOURCES}) | |
| fi | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| TAGS=$(sed "s/main:/superbench:${GITHUB_REF##*/}-/g" <<< ${TAGS}) | |
| GHCR_TAGS=$(sed "s#superbench/superbench#ghcr.io/${{ github.repository }}/superbench#g" <<< ${TAGS}) | |
| SOURCES=$(sed "s/main:/superbench:${GITHUB_REF##*/}-/g" <<< ${SOURCES}) | |
| GHCR_SOURCES=$(sed "s#superbench/superbench#ghcr.io/${{ github.repository }}/superbench#g" <<< ${SOURCES}) | |
| fi | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| TAGS=$(sed "s/main:/dev:/g" <<< ${TAGS}) | |
| SOURCES=$(sed "s/main:/dev:/g" <<< ${SOURCES}) | |
| fi | |
| echo "tags=${TAGS}" >> "$GITHUB_OUTPUT" | |
| echo "sources=${SOURCES}" >> "$GITHUB_OUTPUT" | |
| echo "ghcr_tags=${GHCR_TAGS}" >> "$GITHUB_OUTPUT" | |
| echo "ghcr_sources=${GHCR_SOURCES}" >> "$GITHUB_OUTPUT" | |
| - name: Echo image tags | |
| run: echo ${{ steps.metadata.outputs.tags }} | |
| - name: Echo image sourcs | |
| run: echo ${{ steps.metadata.outputs.sources }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to the GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| if: ${{ github.event_name == 'release' }} | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Merge and push to Docker Hub | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| docker buildx imagetools create \ | |
| --annotation "index:org.opencontainers.image.source=${{ github.event.repository.html_url }}" \ | |
| --annotation "index:org.opencontainers.image.created=${{ github.event.repository.pushed_at }}" \ | |
| --annotation "index:org.opencontainers.image.revision=${{ github.sha }}" \ | |
| --tag ${{ steps.metadata.outputs.tags }} \ | |
| ${{ steps.metadata.outputs.sources }} | |
| - name: Merge and push to GitHub Container Registry | |
| if: ${{ github.event_name == 'release' }} | |
| run: | | |
| docker buildx imagetools create \ | |
| --annotation "index:org.opencontainers.image.source=${{ github.event.repository.html_url }}" \ | |
| --annotation "index:org.opencontainers.image.created=${{ github.event.repository.pushed_at }}" \ | |
| --annotation "index:org.opencontainers.image.revision=${{ github.sha }}" \ | |
| --tag ${{ steps.metadata.outputs.ghcr_tags }} \ | |
| ${{ steps.metadata.outputs.ghcr_sources }} | |
| - name: Inspect image | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| docker buildx imagetools inspect $(echo "${{ steps.metadata.outputs.tags }}" | cut -d, -f1) |