Run Inference in Parallel #119
This file contains 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: Run Inference in Parallel | |
on: | |
workflow_dispatch: | |
inputs: | |
model-id: | |
required: true | |
type: string | |
sample-only: | |
required: false | |
type: string | |
n-workers: | |
description: 'number of workers to use (max 50)' | |
required: true | |
default: '50' | |
type: string | |
permissions: | |
contents: read | |
jobs: | |
start-time: | |
runs-on: ubuntu-latest | |
outputs: | |
start-time: ${{ steps.start-time.outputs.start-time }} | |
steps: | |
- name: Get start time | |
id: start-time | |
run: echo "start-time=$(date +%s)" >> "$GITHUB_OUTPUT" | |
generate-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- id: set-matrix | |
run: | | |
start='1' | |
end=${{ inputs.n-workers }} | |
matrix=$(seq -s ',' $start $end) | |
echo "matrix=[${matrix}]" >> $GITHUB_OUTPUT | |
matrix-inference: | |
needs: generate-matrix | |
if: github.repository != 'ersilia-os/eos-template' | |
strategy: | |
matrix: | |
numerator: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
uses: ./.github/workflows/predict.yml | |
with: | |
numerator: ${{ matrix.numerator }} | |
denominator: ${{ inputs.n-workers }} | |
model-id: ${{ inputs.model-id }} | |
sample-only: ${{ inputs.sample-only }} | |
SHA: ${{ github.sha }} | |
secrets: inherit | |