Skip to content

Sequence models from MC2#8

Merged
wkirgsn merged 9 commits into
mainfrom
mc2
Jun 19, 2026
Merged

Sequence models from MC2#8
wkirgsn merged 9 commits into
mainfrom
mc2

Conversation

@wkirgsn

@wkirgsn wkirgsn commented Mar 15, 2026

Copy link
Copy Markdown
Member

Summary

This PR adds support for the sequence-to-sequence H-field models from the MagNet Challenge 2025 alongside the existing power loss models, exposing both model families through a unified public API.

Given a future B waveform and temperature — plus an optional warmup window of past B/H samples — the new SequenceModel predicts the corresponding future H sequence directly on variable-length waveforms (no fixed-length resampling).

New files

File Purpose
src_py/magnethub/sequence.py Public SequenceModel wrapper (mirrors LossModel)
src_py/magnethub/paderborn_sequence.py Paderborn GRU backend + equinox model building blocks
models/paderborn_sequence_modeling/*.eqx 15 trained GRU8 coefficient files
tests/test_sequence.py 20 unit tests (validation, shapes, accuracy, all-materials smoke)
tests/test_files/unit_test_data_sequence_3C90.csv Measured 3C90 toy data for accuracy regression test

Changed files

File Change
paderborn.pypaderborn_loss.py Renamed for clearer distinction from the sequence backend
__init__.py Registers the new modules
loss.py Updated import path after rename
pyproject.toml Inline dependencies (drops requirements.txt), adds jax/equinox, bumps to Python ≥3.13, includes .eqx in sdist
README.md Rewritten intro presenting both model families as first-class citizens; added usage examples, supported-materials list, and folder-structure entries

Usage

import magnethub as mh

mdl = mh.sequence.SequenceModel(material="3C90", team="paderborn")

# simplest call — past defaults to zero
h = mdl(b_future, temperature)

# with warmup for better accuracy
h = mdl(b_future, temperature, b_past, h_past)

Supported materials (sequence models)

3C90, 3C92, 3C94, 3C95, 3E6, 3F4, 77, 78, FEC007, FEC014, N27, N30, N49, N87, T37

Design decisions

  • Argument order: (b_future, temperature, b_past=None, h_past=None) — the required inputs come first; warmup is optional and defaults to a single zero sample (GRU skips warmup internally when past length is 1).
  • Merged helpers: The equinox building blocks (Normalizer, GRU, RNNwInterface, etc.) live directly in paderborn_sequence.py rather than a separate helpers module, keeping the file count manageable.
  • A–E material mapping: Competition-internal labels A–E are mapped to their real material names (A=3C92, B=3C95, C=FEC007, D=FEC014, E=T37) so users always use human-readable names.

Test results

32 passed, 2 skipped, 1 warning

The 2 skips and 1 warning are pre-existing (debug-gated paderborn loss tests and a CUDA driver warning from the sydney model).

This was linked to issues Mar 15, 2026
@wkirgsn
wkirgsn marked this pull request as ready for review June 4, 2026 09:45
@wkirgsn
wkirgsn requested a review from gituser789 June 4, 2026 09:45
@wkirgsn wkirgsn self-assigned this Jun 4, 2026
@wkirgsn
wkirgsn merged commit ee7e68c into main Jun 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrating Magnet Challenge 2 models Support pandas 3.x

3 participants