diff --git a/.github/workflows/code-quality.yaml b/.github/workflows/code-quality.yaml index 003c7adf..4374b4a8 100644 --- a/.github/workflows/code-quality.yaml +++ b/.github/workflows/code-quality.yaml @@ -98,7 +98,7 @@ jobs: uses: ./.github/actions/setup-raitap-env with: python-version: "3.13" - sync-command: uv sync --group dev --extra torch-cpu --extra mlflow --extra shap --extra captum --extra metrics --extra onnx-cpu --extra reporting --extra torchattacks --extra foolbox --extra xgboost + sync-command: uv sync --group dev --extra torch-cpu --extra mlflow --extra shap --extra captum --extra metrics --extra onnx-cpu --extra reporting --extra torchattacks --extra foolbox --extra xgboost --extra text - name: Ruff run: uv run ruff check . @@ -123,7 +123,7 @@ jobs: uses: ./.github/actions/setup-raitap-env with: python-version: "3.11" - sync-command: uv sync --group dev --extra torch-cpu --extra mlflow --extra shap --extra captum --extra metrics --extra onnx-cpu --extra reporting --extra torchattacks --extra foolbox --extra xgboost + sync-command: uv sync --group dev --extra torch-cpu --extra mlflow --extra shap --extra captum --extra metrics --extra onnx-cpu --extra reporting --extra torchattacks --extra foolbox --extra xgboost --extra text - name: Pytest on 3.11 (floor compatibility, no coverage) run: uv run pytest -m "not e2e and not cuda" -v @@ -144,7 +144,7 @@ jobs: uses: ./.github/actions/setup-raitap-env with: python-version: "3.13" - sync-command: uv sync --group dev --extra torch-cuda --extra mlflow --extra shap --extra captum --extra metrics --extra onnx-cuda --extra reporting --extra torchattacks --extra foolbox + sync-command: uv sync --group dev --extra torch-cuda --extra mlflow --extra shap --extra captum --extra metrics --extra onnx-cuda --extra reporting --extra torchattacks --extra foolbox --extra text - name: CUDA smoke check run: | diff --git a/.github/workflows/package-smoke.yml b/.github/workflows/package-smoke.yml index edbfe75c..2e320e05 100644 --- a/.github/workflows/package-smoke.yml +++ b/.github/workflows/package-smoke.yml @@ -64,7 +64,7 @@ jobs: run: | set -euo pipefail WHEEL=$(ls dist/raitap-*.whl | head -n1) - for extra in torch-cpu onnx-cpu shap captum torchattacks foolbox mlflow metrics reporting launcher xgboost; do + for extra in torch-cpu onnx-cpu shap captum torchattacks foolbox mlflow metrics reporting launcher xgboost text; do echo "::group::extra=${extra}" rm -rf .venv uv venv --python ${{ matrix.python-version }} diff --git a/contributor-configs/text-classification-sst2/README.md b/contributor-configs/text-classification-sst2/README.md new file mode 100644 index 00000000..56faac2a --- /dev/null +++ b/contributor-configs/text-classification-sst2/README.md @@ -0,0 +1,53 @@ +# Text-classification (SST-2 sentiment) smoke config + +End-to-end check for the text input modality (#340): loads a HuggingFace +sentiment model + tokenizer, tokenises a small text CSV into `input_ids` + +`attention_mask`, runs the forward pass + metrics, then `LayerIntegratedGradients` +token attribution over the embedding layer and renders per-token importances +with `CaptumTextVisualiser`. + +This is the keystone that proves the text path works: load -> tokenise -> +predict -> token attribution -> HTML report with per-token panels. + +## Run + +Artifacts (`artifacts/reviews.csv`, `artifacts/labels.csv`) are gitignored +(`contributor-configs/*/artifacts/`), so generate them first: + +```bash +uv run --extra text python contributor-configs/text-classification-sst2/build_data.py +``` + +Then run the assessment: + +```bash +uv run raitap --config-dir contributor-configs/text-classification-sst2 --config-name assessment +``` + +`raitap-deps` infers the `text` (transformers), `captum`, `metrics`, and `html` +extras and installs them. The model +(`distilbert-base-uncased-finetuned-sst-2-english`, ~270 MB) downloads from the +HuggingFace hub on first run. The HTML report lands under +`outputs//