refactor(examples): consolidate v1/v2 into one factory-API trainer per example#251
Merged
Conversation
…r example The factory-API migration left a parallel _v2 C trainer per example (har_classifier_v2, ecg_anomaly_ae_v2) alongside the original Legacy-API train_c.c, which was redundant, never built in CI, and pinned to deprecated APIs. Collapse to one directory per example. Move each _v2 train_c.c (factory API + StateDictApi) into its parent dir; delete the Legacy train_c.c and the _v2 dirs; targets keep their canonical names (train_c_har_classifier, train_c_ecg_anomaly_ae). Rewire the CI bit-parity job + examples/CMakeLists.txt to the consolidated targets/paths. Rewrite the two READMEs to the real flow (bit-parity primary). Make ECG compare.py informational: the train-from-scratch comparison is a sanity check, not a gate (independent init + a C-vs-PyTorch training-dynamics difference push the anomaly AUC outside tolerance; bit-parity is the exact gate). Bit-parity verified identical for both examples (HAR int32, ECG float allclose). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Collapses the v1/v2 example split into one factory-API trainer per example, finishing the unfinished factory-API migration.
Why
The factory-API migration created a parallel
*_v2/train_c.cper example instead of replacing the original. Each example ended up with two C trainers: the Legacy-APItrain_c.c(redundant, never built in CI, pinned to deprecated*LayerInitLegacy+tensorInit*APIs → silently rotting) and the factory-API*_v2/train_c.c(the canonical one CI bit-parity-checks).How
*_v2/train_c.c(factory API +StateDictApi) into its parent dir; delete the Legacytrain_c.cand the*_v2/dirs. Targets keep their canonical names (train_c_har_classifier,train_c_ecg_anomaly_ae).c-bit-parityjob +examples/CMakeLists.txtto the consolidated targets/paths.compare.pyinformational — the train-from-scratch comparison is a sanity check, not a gate (independent init + a C-vs-PyTorch training-dynamics difference push the anomaly AUC outside tolerance; bit-parity is the exact gate). That divergence is a known finding under separate investigation.Verification
allbuilds; both bit-parity checks pass (HAR int32 identical, ECG float allclose) on the combined Issue-C-init + consolidation state.examples/, via chore(examples): remove rotted legacy example/MnistExperiment (#235) #249)._v2dirs).Builds on #250 (Issue C factory init), already merged to
develop.🤖 Generated with Claude Code