Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ src/spine/
train.py reader-agnostic fit() assembly
configs/ Hydra groups: backbone/ task/ optimizer/ scheduler/ callbacks/ trainer/ data/
integrations/spine_graphnet/ graphnet integration: DeepIce backbone + reader adapter
examples/ Hydra launcher (train_curtain.py)
examples/ Hydra launcher (train_curtain.py) + runnable graphnet demo (graphnet_demo.py)
tests/ core-independence gate (spine imports no graphnet)
```

Expand All @@ -65,6 +65,21 @@ python examples/train_curtain.py \
data.train_selection=train.parquet data.val_selection=val.parquet \
callbacks=curtain_auc task/objectives=v2 trainer.devices=4
```

An end-to-end demo of the graphnet frame needs no data of your own: it runs on
the Prometheus example file bundled with a graphnet checkout, pretrains a tiny
DeepIce on CPU in about a minute, and loads the exported encoder back into a
stock graphnet DeepIce:
```
python examples/graphnet_demo.py --out curtain_demo_out
```
The same run is also available through the Hydra path: stage the demo inputs
once, then launch from the experiment config:
```
python examples/graphnet_demo.py --prepare-only
python examples/train_curtain.py +experiment=prometheus_demo
```

## 📥 Reading data
SPINE mandates **no reader**. Provide any PyTorch `Dataset` satisfying the
contract stated canonically in `spine/data/datamodule.py`:
Expand Down
14 changes: 14 additions & 0 deletions configs/data/prometheus_demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# graphnet's bundled Prometheus demo file, staged locally by
# `python examples/graphnet_demo.py --prepare-only` (copies the db and writes
# geometry + selections into curtain_demo_out/). Paths are relative to the
# invocation cwd (the launcher keeps cwd via hydra.job.chdir=false).
db: curtain_demo_out/prometheus-events.db
train_selection: curtain_demo_out/train_selection.parquet
val_selection: curtain_demo_out/val_selection.parquet
n_train: 0
reader:
# the demo module next to the launcher: `python examples/train_curtain.py`
# puts examples/ on sys.path, so the demo's reader resolves without living
# in an installed package
_target_: graphnet_demo.demo_reader
db: ${data.db}
37 changes: 37 additions & 0 deletions configs/experiment/prometheus_demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# @package _global_
# The bundled-Prometheus demo through the Hydra path -- same tiny run as
# examples/graphnet_demo.py. Stage its inputs once, then launch:
# python examples/graphnet_demo.py --prepare-only
# python examples/train_curtain.py +experiment=prometheus_demo
defaults:
- override /data: prometheus_demo
- override /callbacks: curtain_auc

geo: curtain_demo_out/prometheus_demo_geometry.npz
geo_sensor_key: sensor_id
out: curtain_demo_out/curtain_prometheus_demo.pth

# graphnet's own detector for this file supplies the standardization, so the
# encoder pretrained here matches a downstream graphnet fine-tune's inputs
scaler:
_target_: spine_graphnet.scaling.DetectorScaler
detector:
_target_: graphnet.models.detector.prometheus.Prometheus
feature_names: [sensor_pos_x, sensor_pos_y, sensor_pos_z, t, charge]

task:
dt_scale: 100.0

backbone:
d_model: 32
depth: 2
head_size: 8
depth_rel: 1
n_rel: 1
seq_length: 32

trainer:
batch: 8
num_workers: 0
max_epochs: 15
patience: 10
2 changes: 1 addition & 1 deletion configs/task/curtain.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The CURTAIN pretext task -- a self-contained plugin config that pulls in its
# own objectives. The launcher injects the runtime geo + scaler and
# recursive-instantiates the rest. Sampler knobs (holdout_mode, q_lo/q_hi,
# recursive-instantiates the rest. Sampler knobs (q_lo/q_hi,
# pos_k, neg_anchor, rand_neg_frac, min_visible, min_future, resample_tries)
# are task arguments with their defaults in CurtainTask -- override like
# task.q_lo=0.5.
Expand Down
Loading
Loading