fix(harvest): per-worker local_batch_size; GPU assert + mem-fraction for 8B restores#949
Open
ocg-goodfire wants to merge 1 commit into
Open
fix(harvest): per-worker local_batch_size; GPU assert + mem-fraction for 8B restores#949ocg-goodfire wants to merge 1 commit into
ocg-goodfire wants to merge 1 commit into
Conversation
…for 8B restores Three fixes from the first attempt to harvest an 8B JAX run (p-289e3178) at scale: - HarvestConfig.batch_size (global) -> local_batch_size (per-worker): the sharded launcher divided the global batch over workers, so production configs quietly ran every GPU at batch 1. Workers now always forward local_batch_size sequences and the schedule's global batch derives as local_batch_size * world_size. - run_worker asserts backend == gpu for sharded runs: a venv without CUDA jaxlib silently fell back to a ~100x-slower whole-array CPU harvest. - XLA_PYTHON_CLIENT_MEM_FRACTION defaults to 0.95 in the worker: restoring a full 8B-run TrainState (60GB checkpoint + restore staging + frozen target) exceeds the default 0.75 pool on one device (RESOURCE_EXHAUSTED at ~135GB). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PVGsKRCYkqeeVhizuPnVuD
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
Three fixes from the first attempt to harvest an 8B JAX run (p-289e3178, L18-MLP 200k) on the sharded SLURM path:
HarvestConfig.batch_size→local_batch_size(per-worker). The sharded launcher divided the globalbatch_sizeacross the array (ShardServerprocess_count=n_gpus), so any production config quietly ran every GPU at a local batch of 1 — e.g.batch_size: 128on 128 GPUs. Workers now always forwardlocal_batch_sizesequences per batch and the schedule's global batch derives aslocal_batch_size × world_size; total sequences =n_batches × local_batch_size × world_size. No back-compat alias — old configs fail loudly on the removed field.Fail-fast GPU assert for sharded workers. A venv without CUDA jaxlib fell back to CPU silently; a 64-GPU array burned its allocation at ~100× slowdown with nothing in the logs but a jax warning. Sharded workers (
--rankgiven) now assertjax.default_backend() == "gpu". Single-process CPU spot-checks stay allowed.XLA_PYTHON_CLIENT_MEM_FRACTION=0.95default in the worker.open_jax_runrestores the fullTrainState(fp32 masters + Adam + persistent-PGD sources — 60GB checkpoint for the L18 runs) plus the frozen 8B target onto one device; restore staging pushes the peak past the default 0.75 pool (RESOURCE_EXHAUSTEDat ~135GB on a B200). Set before backend init,setdefaultso callers can override.A structural follow-up worth considering separately:
open_jax_runcould partially restore onlycomponents+ci_fn(orbax 0.12partial_restore) — the optimizer states and adversary sources it materializes are dead weight for every consumer, and dropping them would halve harvest GPU pressure. Kept out of this PR to stay minimal.Testing
basedpyright param_decomp_lab/harvest/clean; harvest test suite (62) passes.🤖 Generated with Claude Code
https://claude.ai/code/session_01PVGsKRCYkqeeVhizuPnVuD