[Feature] SHAP-based explainer for torch models #6610
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: darts PR workflow | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Clone repository" | |
| uses: actions/checkout@v4 | |
| - name: "Set up Python 3.11" | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: "Install uv" | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.26" | |
| python-version: '3.11' | |
| - name: "Install Dev Dependencies" | |
| run: | | |
| # Testing against latest compatible versions | |
| uv sync --group dev | |
| - name: "Lint" | |
| run: | | |
| uv run pre-commit run --all-files | |
| tests: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-14, ubuntu-latest] | |
| python-version: ['3.11'] | |
| flavour: ['all'] | |
| steps: | |
| - name: "Clone repository" | |
| uses: actions/checkout@v4 | |
| - name: "Set up Python ${{ matrix.python-version }}" | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: "Install uv" | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9" | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: "Install Dependencies" | |
| run: | | |
| # Testing against latest compatible versions | |
| # dev-all group includes everything: dev, optional, release, torch, notorch | |
| # --group torch-cpu uses CPU-only PyTorch from the configured index | |
| uv sync --group dev-all --group torch-cpu | |
| - name: "Install libomp (for LightGBM)" | |
| run: | | |
| chmod +x ./.github/scripts/libomp-${{ runner.os }}.sh | |
| ./.github/scripts/libomp-${{ runner.os }}.sh | |
| - name: "Run tests" | |
| run: | | |
| uv run pytest --durations=50 --timeout=900 --cov=darts --cov-config=.coveragerc --cov-report=xml darts/tests | |
| - name: "Codecov upload" | |
| if: ${{ matrix.flavour == 'all' }} | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| fail_ci_if_error: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: "Optimize cache for CI" | |
| run: | | |
| # Remove pre-built wheels but keep source-built wheels | |
| # This reduces cache size while retaining expensive-to-rebuild packages | |
| uv cache prune --ci | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Clone repository" | |
| uses: actions/checkout@v4 | |
| - name: "Set up Python 3.11" | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: "Install uv" | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9" | |
| enable-cache: true | |
| python-version: '3.11' | |
| - name: "Install pandoc" | |
| run: | | |
| sudo apt-get install -y pandoc | |
| - name: "Install Dependencies" | |
| run: | | |
| # Testing against latest compatible versions | |
| uv sync --group dev-all --group torch-cpu | |
| - name: "Install libomp (for LightGBM)" | |
| run: | | |
| chmod +x ./.github/scripts/libomp-${{ runner.os }}.sh | |
| ./.github/scripts/libomp-${{ runner.os }}.sh | |
| - name: "Build docs" | |
| run: | | |
| uv run make --directory ./docs build-all-docs | |
| - name: "Optimize cache for CI" | |
| run: | | |
| # Remove pre-built wheels but keep source-built wheels | |
| # This reduces cache size while retaining expensive-to-rebuild packages | |
| uv cache prune --ci | |
| check-examples: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| example-name: [03-FFT-examples.ipynb, 04-RNN-examples.ipynb, 00-quickstart.ipynb, 02-data-processing.ipynb, 01-multi-time-series-and-covariates.ipynb] | |
| steps: | |
| - name: "Clone repository" | |
| uses: actions/checkout@v4 | |
| - name: "Set up Python 3.11" | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: "Install uv" | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9" | |
| enable-cache: true | |
| python-version: '3.11' | |
| - name: "Install Dependencies" | |
| run: | | |
| # Testing against latest compatible versions | |
| uv sync --group dev-all --group torch-cpu | |
| - name: "Install libomp (for LightGBM)" | |
| run: | | |
| chmod +x ./.github/scripts/libomp-${{ runner.os }}.sh | |
| ./.github/scripts/libomp-${{ runner.os }}.sh | |
| - name: "Run example ${{matrix.example-name}}" | |
| working-directory: ./examples | |
| run: | | |
| uv run papermill ${{matrix.example-name}} ${{matrix.example-name}} | |
| - name: "Optimize cache for CI" | |
| run: | | |
| # Remove pre-built wheels but keep source-built wheels | |
| # This reduces cache size while retaining expensive-to-rebuild packages | |
| uv cache prune --ci |