Skip to content

Trainer-agnostic fixes extracted from the fast-llm branch - #151

Open
jlamypoirier wants to merge 12 commits into
mainfrom
jlp_pipelinerl_unrelated_fixes
Open

Trainer-agnostic fixes extracted from the fast-llm branch#151
jlamypoirier wants to merge 12 commits into
mainfrom
jlp_pipelinerl_unrelated_fixes

Conversation

@jlamypoirier

@jlamypoirier jlamypoirier commented Jul 14, 2026

Copy link
Copy Markdown

Trainer-agnostic fixes and improvements developed on the fast-llm integration branch (#140) but independent of the Fast-LLM trainer itself. Extracting them here so they can land on main on their own and shrink the integration PR.

Description prepared with Claude Opus 4.8 (Claude Code).

Changes

  • datasets>=4 compat — a shared load_dataset wrapper (pipelinerl/domains/_datasets_compat.py) forwards trust_remote_code only when the installed datasets accepts it; imported by the chartqa + math loaders.
  • Config-drivable Adam betasfinetune.adam_beta1 / adam_beta2 threaded through get_optimizer (adamw_torch / cpuadam).
  • Rollout robustness (actor.py) — retry on aiohttp.ServerDisconnectedError; treat 4xx rollout responses as skip-not-retry (emit an empty result); drop groups whose rollouts all failed rather than publishing empties; offload the blocking result-queue put to an executor; accept 1..attempts rollouts per group.
  • preprocess.py — accept groups of 1..group_size in the dataset loader's size check, so a skipped/dropped rollout no longer crashes preprocessing with Invalid group sizes; guard the unpacked-mode (seq_packing=false) popleft against a partial queue.
  • launch.py — use sys.executable for subprocess launches; resolve an absolute redis --dir and add --logfile (redis chdirs to --dir before opening the logfile, so a relative path breaks); skip the bf16_last_layer_fp32 quantization override when vLLM runs at a non-bf16 dtype; drop the vLLM-v1-rejected num-scheduler-steps kwarg; give each actor vLLM a distinct VLLM_PORT base to avoid get_open_port() port races.
  • world.py — read GPUS_PER_NODE from the environment instead of hardcoding 8 for multi-node.
  • Logging & crash diagnostics — optional WANDB_API_KEY_PATH login; resilient python_env collection (skips distributions with missing metadata); a component-suffixed W&B run name; on-demand faulthandler (SIGUSR1 all-thread dump, no periodic timer); log training lag as a stats/lag_min / stats/lag_mean / stats/lag_max trio instead of a single value.

Notes

  • Every change is trainer-agnostic and applies to the existing DeepSpeed / HTTP path.
  • All touched files compile and the referenced config fields (wandb.wandb_name, finetune.adam_beta*) exist on main. Not yet runtime-tested — worth a quick smoke before merge.

🤖 Generated with Claude Code

jlamypoirier and others added 7 commits July 14, 2026 16:52
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…name; on-demand faulthandler

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…node

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…le, skip bf16 quant on non-bf16 dtype

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When seq_packing=false, run_preprocessing_loop drains
processed_entries_queue with a fixed-count popleft for train_batch_size
entries without first checking the queue has enough. If the queue holds
fewer than train_batch_size, the loop raises IndexError: pop from an
empty deque and kills the preprocessor.

The bug was masked on fast-llm because fast-llm always takes the
use_fast_llm branch and never enters the unpacked code path. It surfaced
as soon as we ran DeepSpeed/HTTP mode with seq_packing=false to work
around the missing flash-attn wheel for torch 2.10.

Guard with a length check and break out of the inner writing loop;
the outer loop then refills the queue and retries.

(cherry picked from commit 8893d2c)
…label

- Extract the datasets>=4 trust_remote_code compat wrapper into a shared
  pipelinerl/domains/_datasets_compat.py; chartqa and math import it instead
  of each carrying a byte-identical copy.
- Drop the invalid "bf16" token from the vLLM dtype allowlist in launch.py
  (vLLM uses "bfloat16"; "bf16" is not an accepted --dtype value).
- Fix the unpacked-branch preprocess log to say "Unpacked microbatch".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jlamypoirier added a commit that referenced this pull request Jul 14, 2026
Bring the extracted trainer-agnostic fixes (PR #151) in as the base of the
Fast-LLM integration so #140 stacks on top and its diff shows only the
integration-specific delta.

Conflicts (the review improvements #151 gained after extraction) resolved in
favor of #151: dedup the datasets>=4 load_dataset shim into
pipelinerl/domains/_datasets_compat.py (drop the now-dead `import inspect` from
both loaders), drop the invalid "bf16" vLLM dtype token, and label the unpacked
preprocess log correctly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extracted from the fast-llm integration branch; all apply to the existing
DeepSpeed / HTTP path.

- actor.py: retry on aiohttp.ServerDisconnectedError; skip (don't retry) 4xx
  ClientResponseError rollouts, emitting an empty result; drop groups whose
  rollouts all failed instead of publishing empties; run the blocking
  result-queue put in an executor; relax the group-size assert to 1..attempts.
- launch.py: drop the vLLM-v1-rejected num-scheduler-steps kwarg; give each
  actor vLLM a distinct VLLM_PORT base to dodge get_open_port()'s TOCTOU race.
- async_llm.py: treat finish_reason == "abort" (weight update in progress) as a
  retryable TimeoutError.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jlamypoirier
jlamypoirier requested a review from rafapi July 15, 2026 15:53
stats/lag reports last_broadcasted_version - min_actor_version, i.e. the
staleness of the oldest sample in the batch (a max). Add stats/lag_min
(vs the newest sample) and stats/lag_mean (batch mean) so the full lag
distribution is visible. The mean accumulates over non-sentinel batches
only, since sentinel batches carry the newest version and would bias it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jlamypoirier and others added 3 commits July 15, 2026 13:07
- preprocess.py: the rollout-robustness changes let a group publish fewer than
  `attempts` rollouts (a 4xx-skipped or empty rollout is filtered out), but
  _check_group_sizes required exactly group_size and raised ValueError, crashing
  the preprocessor. Accept 1..group_size, matching the actor's group-size assert.
- async_llm.py: remove the unreachable `finish_reason == "abort"` block (the
  retry loop already handles aborts via _is_retryable_abort_response, and
  make_training_text raises RetryableAbortedCompletionError) and its now-unused
  `import asyncio`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants