Repository navigation
Conversation
…drivers own the size filter
…eckpointing/pytorch
run_split clamps the spawned rank count to _dist.MAX_RANKS, so a row with
world_size above the cap used to spawn 16 ranks and then fail inside
init_device_mesh, after the per-case bucket had already been created.
PyTorchCheckpointConfigurator.validate_case now rejects such rows when
the yaml is loaded.
Also guards os.cpu_count() against None in the rank setup and load
functions, and adds short comments on the identical per-rank seeding
limitation in materialize, on split_stage producing a ModuleDict that is
not usable with HF forward, and on the distinct setup/run seeds and
post-load planner and checksum checks in driver.py.
Test Plan:
PYTHONPATH=$PWD python -m pytest gcsfs/tests/perf/subsystembenchmarks/checkpointing gcsfs/tests/perf/subsystembenchmarks/tests --run-benchmarks-infra -q
pre-commit run --files <changed files>
99 passed. The new test_validate_case_rejects_world_size_exceeding_max_ranks
was observed failing (DID NOT RAISE) before the validate_case change.
This commit was written with help from an AI coding assistant.
There was a problem hiding this comment.
Code Review
This pull request introduces a new native PyTorch checkpointing benchmark group (checkpointing/pytorch) to measure torch.distributed.checkpoint.load performance from GCS across various parallelism strategies (FSDP2, HSDP, TP, PP, EP). It also refactors shared distributed utilities into a common _dist.py module to eliminate duplication across existing benchmark groups, updates the BigQuery schema to support the new metrics, and adds comprehensive tests. Feedback on the changes identifies a critical bug in the custom load planner where accessing itemsize on a torch.dtype will raise an AttributeError at runtime; using torch._utils._element_size is recommended instead.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1091 +/- ##
=======================================
Coverage 90.76% 90.76%
=======================================
Files 16 16
Lines 3650 3650
=======================================
Hits 3313 3313
Misses 337 337 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Stacked on #1088. Please review only the last commit (
feat(subsystembenchmarks): expert-parallel case on OLMoE for checkpointing/pytorch); earlier commits belong to #1087 and #1088.Summary
Adds two OLMoE-1B-7B-0924 rows (38.7 GiB checkpoint, ws8):
fsdpandepdp8ep8. Withfsdp, every expert tensor is sliced 8 ways. Withep, each rank owns 8 whole experts per layer.How it works
epkeeps the dense params on FSDP2 overdp_shard.keep_local_expertskeeps only this rank's experts, keyed by their original index so FQNs stay canonical (model.layers.<L>.mlp.experts.<i>). Those experts are passed asignored_paramsto the per-layerfully_shard, so they stay plain tensors that still have optimizer state.dp_shardranks and is not a mesh dimension.validate_caserequiresexpert_parallel_size == data_parallel_sizeforepand 1 otherwise.transformers==4.46.3pin, where each expert is its own module. Newer versions stack experts into one tensor, andepwould then load likefsdp.fsdprow is on themodelaxis, so run the pair with--sweep-axes="model strategy".Test Plan
106 passed. Same infra tests as the previous PR, plus a tiny OLMoE config (2 layers, 16 experts):
test_parallelize.py: each of 8 fake ranks keeps exactly its 2 experts per layer as plain trainable tensors, dense params stay FSDPShard(0), and the expert FQN sets across ranks are disjoint and cover every expert.test_roundtrip.py: a real glooepsave/load round trip matches checksums, and the driver reports fewer read items per rank forepthan forfsdpon the same model.test_configs.py: the two OLMoE case names and theexpert_parallel_sizevalidation.This PR was written with help from an AI coding assistant.