specsrbench.build.predictions

Stage 1 – run the specsr chain over the held-out split, from Hub weights.

This is the ML arm of the benchmark, and the only stage that needs torch, a GPU (optional) and network access. It loads SR1, the redshift head and SR2 from the Hugging Face Hub, runs them over the 572 held-out galaxies of the group-wise 80/20 split, and writes their predictions in physical units.

Why the Hub and not a local checkpoint

The predictions the published numbers were computed from came from three files inside a training-run directory on one workstation. An earlier generation of this paper’s ML arm was lost exactly that way – cache/ in this project is a committed 229 MB of arrays that cannot be regenerated because the checkpoints behind them no longer exist anywhere. The weights on the Hub are the same three files, verified byte-identical to the run directory they came from, and are addressable from any machine.

The one trap this stage cannot check for you

specsr has shipped more than one file called best_sr2.pth, trained on different wavelength grids. A checkpoint from the wrong grid does not fail loudly; it produces plausible spectra that are wrong. The Hub revision is pinned in specsr.checkpoints.DEFAULT_REVISION for that reason, and the provenance of whatever was actually loaded is written into the output, so the arrays can always be traced back to the weights that made them.

Module Attributes

SPLIT

The split both papers evaluate on.

Functions

main([argv])

Run SR1 -> ZHead -> SR2 over the held-out split and cache the result.

specsrbench.build.predictions.SPLIT = 'val'

The split both papers evaluate on. Group-wise on the parent galaxy, so all 21 augmented rows of a galaxy fall on the same side: a flat row-wise split leaks ~16 near-duplicate siblings of each held-out galaxy into training and inflates every held-out metric.

specsrbench.build.predictions.main(argv=None)[source]

Run SR1 -> ZHead -> SR2 over the held-out split and cache the result.

Return type:

int