Repository navigation
[1/10] fix(runtime): retain references across partial and invalid streaming reads - #957
Merged
Merged
Conversation
This was referenced Oct 14, 2026
yushengsu-thu
added a commit
to yushengsu-thu/SpecForge
that referenced
this pull request
Oct 15, 2026
… to exp_read.me Same base as the dense-1/8 branch (PR sgl-project#942 stack sgl-project#957-sgl-project#963 merged there, DDP-wrapped draft lookup for MoE metrics, managed-local NCCL port pin); the experiment log is exp_read.me like on dense-1/8. Co-Authored-By: Claude Fable 5.1 <[email protected]>
yushengsu-thu
added a commit
to yushengsu-thu/SpecForge
that referenced
this pull request
Oct 15, 2026
…yers 1-7 of the sgl-project#942 split), matching the dense-1/8 branch The combined PR sgl-project#942 merge was reverted in the previous commit; this takes the split stack instead (sgl-project#957 streaming-read fixes, sgl-project#958 DDP sync once per accumulation window, sgl-project#959 no implicit qwen3-instruct system prompt, sgl-project#960 is_causal, sgl-project#961 fused DFlash head, sgl-project#962 selective checkpoint contexts, sgl-project#963 shared flatten_vocab_projection / cache_vocab_projection), so the MoE arm carries exactly the same upstream code as the dense-1/8 arm. Conflicts in specforge/training/backend.py and controller.py resolved in the stack's favour. Co-Authored-By: Claude Fable 5.1 <[email protected]>
yushengsu-thu
added a commit
to yushengsu-thu/SpecForge
that referenced
this pull request
Oct 15, 2026
…ense-1/8 branch Taking the stack's side of the merge conflicts had dropped this branch's own changes to specforge/training/backend.py and controller.py: the MoE checkpoint state-dict naming conversion (to_checkpoint_state_dict / from_checkpoint_state_dict), the fsdp_replicate_when_frozen candidates, the SPECFORGE_FSDP_SHARDED_GRAD_ACCUM path and the perf/mem_* allocator metrics. The files are now the dense-1/8 versions (base + PR stack sgl-project#957-sgl-project#963), plus dense-1/8's launch_plan.py fix pinning each capture server's --nccl-port, so specforge/ is identical across the two arms. Recipe: flatten_vocab_projection / cache_vocab_projection (the sgl-project#963 names), save_interval 1196 with 12 checkpoints kept (9 per epoch, the 9th on the epoch boundary), in-flight window 264/132 and no consumer_dispatch override, all as on dense-1/8. Co-Authored-By: Claude Fable 5.1 <[email protected]>
yushengsu-thu
added a commit
to yushengsu-thu/SpecForge
that referenced
this pull request
Oct 15, 2026
…l-project#963 + sgl-project#966) into the MoE experiment branch The same upstream content was already merged here independently; this records the fork branch's current head as an ancestor. The two MoE config files that spark-Qwen3-8B also carries are kept in this branch's version (the one the running experiment uses). Co-Authored-By: Claude Fable 5.1 <[email protected]>
curnane-lab
reviewed
Oct 17, 2026
Comment on lines
+356
to
+357
| if line.strip(): | ||
| out.append(ref_from_dict(json.loads(line.decode("utf-8")))) |
Collaborator
There was a problem hiding this comment.
If the JSON parses but ref_from_dict rejects it, this raises bare — no offset, and since the offset never commits, a restarted consumer crashes at the same record with nothing to go on.
Collaborator
There was a problem hiding this comment.
I think we can just throw a valueError here. e.g.
raw = json.loads(line.decode("utf-8"))
try:
ref = ref_from_dict(raw)
except (KeyError, TypeError, AttributeError) as exc:
raise ValueError(
f"StreamingRefChannel {self.path}: "
f"invalid SampleRef at byte offset {next_offset}: {exc}"
) from exc
out.append(ref)
curnane-lab
approved these changes
Oct 17, 2026
Collaborator
|
Overall LGTM, nits to be addressed |
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.
Motivation
A partial or transiently invalid JSONL reference must not advance the reader past an unconsumed sample.
Modifications
Commit the byte offset only after complete records validate. Reopen and retry transient decode errors with bounded retries, and raise on persistent corruption. Preserve max_n, acknowledgement, and closed-source behavior.
Stack and dependencies
Layer 1/10 split from #942. Bottom layer; base:
main. Review the diff against this PR's base branch; it contains only this layer. The full stack index is maintained in #942.Actual prerequisites: No earlier feature is required; this layer uses existing main APIs.
The linear stack is the review/merge order. Model-specific optimizations are independently opt-in; the projection-checkpointing and attention layers expose shared capabilities. When merging a lower PR with squash, restack the remaining branches before merging them so already-reviewed commits do not reappear. The repository GPU test workflow only auto-runs for PRs targeting main; upper layers need that CI run when retargeted, while lint runs for all PRs.
Source: #942 at
211b87fc7d707e3a628cb95de5c73340af863c04, split onto mainfdcc2eddf1b56b5b24a5a15d3abcb366adfeb5aa. The original branch is preserved.Accuracy Test
bb9017afeca6: 36 tests run, zero failures/errors on H20 with Python 3.11.12 / PyTorch 2.13.0+cu130.eaa14f102d6a: 405 integration tests run, zero failures/errors; 2 skipped on H20 with Python 3.11.12 / PyTorch 2.13.0+cu130. Each module runs in a fresh process to isolate process-global distributed state. This is targeted regression coverage, not a full-suite or downstream task-accuracy claim.Layer command (run in this branch's checkout,
PYTHONPATH=.):Qwen3 tokenizer regressions reuse the cached official tokenizer with
HF_HUB_OFFLINE=1andHF_HUB_CACHEpointing to that cache. No training job was launched.Benchmark & Profiling
No new end-to-end throughput or downstream accuracy benchmark was run for this split. Model-side tests exercise numerical parity and gradients; historical measurements remain in #942 with their original scope and caveats.
Checklist