diff --git a/.github/workflows/train_and_inference.yml b/.github/workflows/train_and_inference.yml index 4f732c4..b4aa199 100644 --- a/.github/workflows/train_and_inference.yml +++ b/.github/workflows/train_and_inference.yml @@ -1,36 +1,13 @@ -name: Train and Inference with SLSA +name: Train and Inference on: - workflow_dispatch: - inputs: - model_type: - description: Name of the model (implies framework) - required: true - type: choice - options: - - model.pth push: branches: - main - paths-ignore: - - '**/*.md' - - '*.md' - - -permissions: read-all - -defaults: - run: - shell: bash jobs: - train: - name: Train model - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false # Don't cancel other jobs if one fails - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + train_and_inference: + runs-on: ubuntu-latest steps: - name: Checkout repository @@ -39,7 +16,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.12.2 + python-version: 3.11 - name: Install dependencies run: | @@ -47,46 +24,11 @@ jobs: pip install -r requirements.txt - name: Generate Dataset - run: | - python generate_dataset.py - tar -czvf dataset.tgz dataset.npz + run: python generate_dataset.py - name: Train Model run: python train_model.py - - name: Generate SLSA Attestation for Dataset - run: | - checksum=$(sha256sum dataset.tgz | cut -d ' ' -f 1) - echo "Dataset checksum: $checksum" - # Use the checksum to generate SLSA attestation - - - name: Generate SLSA Attestation for Model - run: | - checksum=$(sha256sum model.pth | cut -d ' ' -f 1) - echo "Model checksum: $checksum" - # Use the checksum to generate SLSA attestation - - id: hash - env: - MODEL: ${{ github.event.inputs.model_type }} - run: | - set -euo pipefail - (sha256sum -t "$MODEL" || shasum -a 256 "$MODEL") > checksum - echo "hash-${{ matrix.os }}=$(base64 -w0 checksum || base64 checksum)" >> "${GITHUB_OUTPUT}" + - name: Run Inference + run: python run_inference.py - provenance: - if: ${{ github.event_name != 'pull_request' }} - needs: [train] - strategy: - fail-fast: false # Don't cancel other jobs if one fails - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ubuntu-latest - permissions: - actions: read - id-token: write - contents: write - steps: - - name: Run SLSA Generator - uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.9.0 - with: - base64-subjects: ${{ needs.train.outputs.hash }} \ No newline at end of file