Giuliocc's picture
Clarify usage and reproduction instructions
80ed05b verified
|
Raw History Blame Contribute Delete
4.23 kB
# Local, verified response replay
JSON baselines and both cross-wave modes use the Python 3.10+ standard library.
The encoder requires Python 3.12, the pinned CPU dependencies below and the
pinned MiniLM base. No inference provider, Job, paid API or server is called.
Download this model snapshot, then run from its repository root. For the
encoder, place the base files in `base/` first.
```python
from pathlib import Path
import json
from runtime import predict
bundle = Path(".")
request = json.loads((bundle / "example-request.json").read_text())
result = predict(bundle, request)
if result["status"] == "ok":
print(result["prediction"]["probabilities"])
else:
print(result["status"], result["reason"])
```
Obtain `expected_manifest_sha256` from a trusted, pinned portfolio registry,
then verify the manifest. A manifest supplied with untrusted weights does not
authenticate itself. The runtime checks every declared model, registry,
support and encoder-base file before running. It returns option-ID-keyed
probabilities and exact source revisions, or an explicit abstention/error.
Changed instruments, unknown population cells and future-wave modes abstain.
For the encoder, use a dedicated environment:
```sh
python -m venv .venv-windtunnel
.venv-windtunnel/bin/pip install torch==2.7.1+cpu --index-url https://download.pytorch.org/whl/cpu
.venv-windtunnel/bin/pip install transformers==4.53.3 safetensors==0.5.3 huggingface-hub==0.36.2
```
Fetch these six files from
`sentence-transformers/all-MiniLM-L6-v2` at revision
`1110a243fdf4706b3f48f1d95db1a4f5529b4d41` into the bundle's `base/` directory:
`config.json`, `model.safetensors`, `special_tokens_map.json`, `tokenizer.json`,
`tokenizer_config.json`, `vocab.txt`. For example:
```python
from huggingface_hub import snapshot_download
snapshot_download("sentence-transformers/all-MiniLM-L6-v2",
revision="1110a243fdf4706b3f48f1d95db1a4f5529b4d41",
allow_patterns=["config.json", "model.safetensors", "special_tokens_map.json",
"tokenizer.json", "tokenizer_config.json", "vocab.txt"],
local_dir="base")
```
Their expected hashes are in `runtime-manifest.json`. Inference uses one CPU
thread, `trust_remote_code=False`, local files only, and safetensors. No model
pickle is accepted. The default encoder remains the original research
checkpoint; the newly trained replacement failed its registered comparison.
# Reproduce the experiments
The [pinned training source](https://huggingface.co/datasets/Giuliocc/windtunnel-response-data/tree/7ed134accbc1ca473a19385fcb238956958ad688/expansion_v2/source) contains the `src/` scripts,
protocol and training requirements. Download that source subtree separately
from this inference snapshot.
```sh
hf download Giuliocc/windtunnel-response-data --repo-type dataset \
--revision 7ed134accbc1ca473a19385fcb238956958ad688 \
--include 'expansion_v2/source/*' --local-dir windtunnel-training
cd windtunnel-training/expansion_v2/source
```
Use empty `raw/`, `base/`, `inputs/` and `results/` directories. Preserve
`configs/protocol.v2.json` and its digest. Install `requirements-training.txt`
plus the CPU torch wheel before running these commands:
```sh
python src/fetch_inputs.py
pdftotext -layout raw/ces22-pre.pdf raw/ces22-pre.txt
pdftotext -layout raw/ces22-guide.pdf raw/ces22-guide.txt
pdftotext -layout raw/ces24-guide.pdf raw/ces24-guide.txt
PYTHONPATH=src python src/build_registry.py
PYTHONPATH=src python src/train_known.py
PYTHONPATH=src python src/report_known_slices.py
PYTHONPATH=src python src/train_encoder.py
PYTHONPATH=src python src/train_cross_wave.py
PYTHONPATH=src python src/build_public_data.py
PYTHONPATH=src python src/package_release.py
PYTHONPATH=src python src/check_runtime.py
```
The original results are immutable first-pass evidence. Use a separate directory
for reruns and compare their checkpoint digests and metrics. Cross-wave named
instrument registration is created before its fit; keep that original receipt
when rerunning. The source files require roughly 370 MB, the base roughly 90 MB,
and a CPU Python environment additional space. Raw CSV files contain public
respondent records and are excluded from every publication allowlist.