# Model-lab training stack (issue #1585).
#
# Version-pinned for reproducibility — a manifest that can't reproduce its
# own eval numbers is a bug (issue #1585 pitfall). These pins are a
# security-clean starting set for PR2's encoder baseline; PR2 captures the
# EXACT versions of a real train run into the manifest's hyperparams/hardware.
#
# IMPORTANT: this file is NOT needed for CI. The seeded data generator
# (generate-data.py) and its selfcheck/determinism tests are stdlib-only and
# run on plain `python3` with no `pip install`. This file only matters on
# the lab GPU box, for train.py / eval.py.
#
# Trimmed to what the recipes truly import (train.py: torch/transformers/
# datasets + numpy-via-torch; eval.py: torch/transformers; hf_push needs
# huggingface-hub). sentence-transformers / scikit-learn were not imported.
#
# Reproducing an ALREADY-TRAINED model: install the exact versions recorded
# in that model's manifest.json trainingStack.libs (verify with
# pipFreezeSha256), NOT this file at HEAD — this file is the forward-looking
# stack for NEW runs and moves ahead of committed manifests when deps bump.
# common.training_stack.assert_stack_matches_requirements() surfaces the
# drift; per its contract, drift means this pin file moved, not that the
# manifest is wrong.

# --- Encoder baseline stack (DeBERTa-v3-large, first choice per #1585) -----
# Security pins (dependency-review, fail-on-severity: high):
#   torch >= 2.6.0   — patches GHSA-53q9-r3pm-6pq6 (torch.load weights_only RCE)
#   PyTorch 2.12 defaults to CUDA 13.0 on PyPI; the lab RTX 3090 box stays on
#   the CUDA 12.x / 550-570 driver stack, so install the CUDA 12.6 wheel.
#   transformers >= 5.3.0 — patches GHSA-29pf-2h5f-8g72 (RCE) plus the
#     deserialization cluster GHSA-qxrp-vhvm-j765 / -hxxf-235m-72v3 /
#     -wrfc-pvp9-mr9g (all < 4.48.0).
--extra-index-url https://download.pytorch.org/whl/cu126
torch==2.12.1+cu126
transformers==5.5.0
datasets==3.6.0
huggingface-hub==1.5.0  # transformers 5.5.0 requires huggingface-hub>=1.5.0,<2.0
# Trainer runtime deps the pinned base model + Trainer need (review round 2):
#   sentencepiece — microsoft/deberta-v3-large SentencePiece tokenizer.
#   accelerate    — Trainer / TrainingArguments device management.
sentencepiece==0.2.1  # >=0.2.1: GHSA-38vq-g6vr-w8wf
accelerate==1.14.0

# --- Correction-intent v1: shares the encoder stack above (issue #1738) ----
# v1 is a DETECTION classifier (turn window -> {correction, none}) — same
# RoBERTa-large encoder + HF Trainer stack as the faithfulness gate. The
# original #1585 plan called for a <=4B instruct causal LM (TRL/LoRA) emitting
# the full corrections[] JSON block, but the pre-#1737 pins (trl==0.16.6 /
# bitsandbytes==0.44.1) DO NOT EXIST on PyPI, and the only resolvable trl
# (1.7.1) drags datasets 3.6 -> 5.0 and would break the faithfulness-gate v1
# pinned stack in the shared venv. Detection F1 is the eval gate (#1585), and
# roberta-large-mnli (the documented <=4B fallback) already trained cleanly on
# this box (#1737). So v1 needs NO extra pins beyond the encoder stack above.
# The structured-extraction path (correctedAssertion span + polarity) is the
# v2 causal-LM follow-up; when it lands it pins real, resolvable
# trl/peft/bitsandbytes versions here and manifest_schema regrows them in
# TASK_REQUIRED_LIBS. Until then this file installs cleanly with
# `pip install -r model-lab/requirements.txt` (no broken pins).
