The HF Space build keeps failing somewhere in the giant build-time RUN
block (BBB train + EEG + MRI + RAG ingest), and the failure log gets
truncated past 50KB so we can't see the actual error.
Strategy change: build only installs deps + copies code + runs the fast
seed_demo_artifacts.py stub generator. Everything else moves to
docker-entrypoint.sh as idempotent guards. The image is smaller, the
build is fast and reliable, and pipeline failures (if any) become
runtime warnings instead of build aborts.
The entrypoint now runs (with NEUROBRIDGE_DISABLE_MLFLOW=1, each step
'|| true' so a single failure doesn't kill startup):
- BBB feature extraction + classifier train (if joblib missing)
- EEG feature extraction (if parquet missing)
- MRI feature extraction + ComBat (if parquet missing)
- RAG FAISS index build (if index.bin missing)
- seed_demo_artifacts.py (idempotent — fills any missing stub)
Cold-start cost: +~30s on first container start. Build cost: drops
from ~6 min to ~3 min and…
The previous build's truncated log showed pip install succeeded but
something later in the heavy pipeline-train RUN block aborted. Three
defensive changes so the next build either succeeds or fails with a
clearer diagnosis:
- apt-get install git: silences the MLflow 'Bad git executable' warning
and lets MLflow tag runs with a proper SHA when needed.
- NEUROBRIDGE_DISABLE_MLFLOW=1 prefixed on every build-time pipeline
invocation: avoids MLflow run-tagging fragility in the slim image
during build. The runtime entrypoint can re-enable MLflow if desired.
- Move 'python scripts/seed_demo_artifacts.py' BEFORE the pipeline
train block so the core showcase paths (MRI 2D / MRI ONNX / EEG joblib
/ clinical RAG / axial PNG) are guaranteed to land even if the BBB
classifier train or MRI ComBat pipeline trips. The seed step is also
re-run after RAG ingest (idempotent — only fills missing artifacts).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix(docker): install CPU-only torch to avoid 2GB NVIDIA CUDA wheels in HF Space build
HF Space deployment needs every showcase path to work without external
data. Five artifacts are gitignored (model binaries, RAG index, derived
fixtures) so they have to be (re)generated at image-build time.
- scripts/seed_demo_artifacts.py: idempotent generator for
data/processed/mri_dl_2d/best_model.pt (random resnet18 4-class),
data/processed/mri_model.onnx (dynamic-D/H/W ONNX biased to 'abnormal'),
data/processed/eeg_clf.joblib (synthetic-separable RandomForest),
data/external_rag/index/rag_index.pkl (4-chunk synthetic clinical
TF-IDF index), and tests/fixtures/mri_sample/subject_0_axial.png
(axial slice from the bundled NIfTI). Each step is a no-op when the
artifact already exists.
- Dockerfile.hf: COPY scripts/, RUN seed_demo_artifacts.py after the
pipeline + FAISS-index build steps. Keeps Dockerfile (HF
auto-discovered name) byte-identical to Dockerfile.hf.
- docker-entrypoint.sh: re-run the seed script on container start so a
mounted-volume deploy can re-s…
The image was forcing the explainer into template-only mode at the
container level, so the OPENROUTER_API_KEY secret on HF Space had no
effect. Removing the kill-switch lets the explainer reach the live
LLM path. The user can still re-enable the kill-switch by setting
NEUROBRIDGE_DISABLE_LLM=1 as an HF Space variable for outage drills.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix(deploy): seed EEG fixture, run all pipelines at build, drop MLflow kill-switch
The Experiments tab was permanently empty and the BBB provenance strip
showed dashes because NEUROBRIDGE_DISABLE_MLFLOW=1 short-circuited the
MLflow file-store lookups even though mlruns/ IS produced inside the
image at build time. Drop the env, run EEG + MRI pipelines too so all
three experiments have at least one run, and seed data/raw/eeg.fif
from the fixture so the Signal tab works on first click.
fix(deploy): seed data/raw + run bbb_pipeline before bbb_model in build
Build-time crash: data/raw/bbbp.csv is gitignored locally, so the
previous COPY data/raw/ instruction copied an empty directory into
the image; bbb_pipeline never produced bbbp_features.parquet, and
bbb_model.main() raised FileNotFoundError on the missing parquet.
Fix: drop the now-useless COPY data/raw/, instead RUN a single shell
chain that:
1. mkdir -p data/raw data/processed
2. cp tests/fixtures/bbbp_sample.csv data/raw/bbbp.csv (self-contained)
3. python -m src.pipelines.bbb_pipeline (produces parquet)
4. python -m src.models.bbb_model (trains, persists joblib)
The existing deploy smoke tests still pass — they only assert that
'src.models.bbb_model' appears in the Dockerfile, which it still does.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
deploy: alias Dockerfile.hf to Dockerfile for HF Spaces auto-discover
Hugging Face Spaces (Docker SDK) requires the build entry point at
./Dockerfile by convention. This is a literal copy of Dockerfile.hf
so the existing tests/deploy/test_dockerfile_hf.py contract still
inspects the canonical Dockerfile.hf source.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat(deploy): Dockerfile + compose for api + mlflow server