Repository navigation
docs(ezpz): salvage MoE TP>1 diagnosis and link checker from #15 - #77
Merged
Merged
Conversation
Checks docs->docs links, code->docs paths and depth-counted paths. On current ezpz it reports 51 dangling references. Not wired into any hook or CI yet.
Reviewer's GuideImplementationAdd a standalone checker for dangling documentation links, code path references, and fragile depth-based paths.
DocumentationRestore the MoE TP>1 diagnosis, document the TP=2 checks and their limits, and identify runtime mesh resolution as the remaining investigation.
Correct the journal links and wording in the production SFT documentation.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 7 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="torchtitan/experiments/ezpz/scripts/check_doc_links.sh" line_range="42-47" />
<code_context>
+ for fn in files:
+ if not fn.endswith(".md"): continue
+ p = os.path.join(r, fn)
+ for m in re.finditer(r'\]\(([^)\s]+\.md)(?:#[^)]*)?\)',
+ open(p, errors="replace").read()):
+ t = m.group(1)
+ if t.startswith(("http://", "https://", "#")): continue
+ if not os.path.exists(os.path.join(r, t)):
+ bad.append("%s -> %s" % (os.path.relpath(p, root), t))
+
+# 1b. markdown OUTSIDE docs/ that links INTO it
</code_context>
<issue_to_address>
**Broken headings pass link checks**
When an internal Markdown link points to an existing file but names a missing fragment, `check_doc_links.sh` checks only the destination file and drops the fragment, so the link passes even though its heading does not exist.
Validate each fragment against the destination headings in both link scans.
Also at `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:63`.
</issue_to_address>
### Comment 2
<location path="torchtitan/experiments/ezpz/scripts/check_doc_links.sh" line_range="42" />
<code_context>
+ for fn in files:
+ if not fn.endswith(".md"): continue
+ p = os.path.join(r, fn)
+ for m in re.finditer(r'\]\(([^)\s]+\.md)(?:#[^)]*)?\)',
+ open(p, errors="replace").read()):
+ t = m.group(1)
</code_context>
<issue_to_address>
**Titled links pass unchecked**
When a Markdown link in `docs/` uses a title after its `.md` destination, or a link outside `docs/` uses a single-quoted or parenthesized title, `check_doc_links.sh`'s Markdown-link patterns require `)` after the destination or support only double-quoted titles, so those links are not checked and dangling targets pass.
Update both Markdown-link scans to recognize optional double-quoted, single-quoted, and parenthesized titles before validating each destination.
Also at `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:43`, `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:61-62`.
</issue_to_address>
### Comment 3
<location path="torchtitan/experiments/ezpz/scripts/check_doc_links.sh" line_range="37" />
<code_context>
+bad = []
+
+# 1. docs -> docs
+for r, dirs, files in os.walk(docs):
+ dirs[:] = [d for d in dirs if not d.startswith(".")]
+ for fn in files:
</code_context>
<issue_to_address>
**Unreadable trees pass silently**
When a docs or source subdirectory cannot be read during the scan, `os.walk` defaults to ignoring directory traversal errors, so it skips an unreadable subtree and the checker can still print `all internal doc links resolve` without checking its contents. The other scans use the same default and likewise omit inaccessible files.
Pass an `onerror` handler that records the error and makes the checker exit nonzero.
Also at `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:56`, `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:82`, `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:125`, `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:162`, `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:183`.
</issue_to_address>
### Comment 4
<location path="torchtitan/experiments/ezpz/scripts/check_doc_links.sh" line_range="119" />
<code_context>
+# Only flags a path whose FIRST segment names a real (or once-real) docs
+# directory, so an unrelated docs path in an external URL and other coincidental
+# matches stay quiet.
+bare = re.compile(r'docs/([A-Za-z0-9_./-]+)')
+known_tops = set(os.listdir(docs)) | {
+ "production", "evals", "guides", "experiments", "summaries", "scaling",
</code_context>
<issue_to_address>
**External docs URLs fail checks**
When a Markdown, Python, or shell line contains an HTTP(S) URL with a `docs/<known-top>/...` path absent from local docs, `bare.finditer` treats the URL path as a local docs reference, so `os.path.exists` adds a valid external link to `bad` and the checker exits 1.
Exclude HTTP(S) URLs from the bare-path scan before checking local docs paths.
Also at `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:134-137`.
</issue_to_address>
### Comment 5
<location path="torchtitan/experiments/ezpz/scripts/check_doc_links.sh" line_range="47" />
<code_context>
+ t = m.group(1)
+ if t.startswith(("http://", "https://", "#")): continue
+ if not os.path.exists(os.path.join(r, t)):
+ bad.append("%s -> %s" % (os.path.relpath(p, root), t))
+
+# 1b. markdown OUTSIDE docs/ that links INTO it
</code_context>
<issue_to_address>
**Case-mismatched links pass unnoticed**
When the checker runs on a case-insensitive filesystem and a Markdown target differs from the tracked path only by capitalization, on a case-insensitive filesystem, `os.path.exists` accepts a target whose capitalization differs from the tracked path, even though the published URL is case-sensitive. The checker then misses the broken link and reports a clean result.
Validate targets against exact-case repository paths rather than relying on host filesystem path lookup.
Also at `torchtitan/experiments/ezpz/scripts/check_doc_links.sh:68`.
</issue_to_address>
### Comment 6
<location path="torchtitan/experiments/ezpz/docs/guides/known-bugs/moe-tp2-wo-placement.md" line_range="394" />
<code_context>
+.venv/bin/python -c "
+from torchtitan.experiments.ezpz.moe.config_registry import moe_debugmodel
+cfg = moe_debugmodel(); cfg.parallelism.tensor_parallel_degree = 2
+m = cfg.model_spec.model; m.update_from_config(config=cfg)
+sc = m.layers[0].attention.inner_attention.sharding_config
+print(sc.local_map, {k: sorted(a.value for a in v.axes())
</code_context>
<issue_to_address>
**Reproduction snippet fails immediately**
When a reader runs the reproduction snippet as written, `moe_debugmodel()` returns a config whose model is stored in `cfg.model`; it has no `model_spec` attribute. Copying the snippet therefore raises `AttributeError` before the documented checks run.
Use `m = cfg.model` in the snippet.
</issue_to_address>
### Comment 7
<location path="torchtitan/experiments/ezpz/docs/guides/known-bugs/moe-tp2-wo-placement.md" line_range="351-353" />
<code_context>
+agpt in q_TNH/k_TNH/v_TNH, out, 3x grad -> all ['cp', 'dp', 'tp']
+```
+
+`resolve_shared_mesh` therefore receives identical input from both, so
+`resolved_mesh is None` cannot distinguish them either. **All three exits are
+eliminated.**
+
+Also checked and identical: both `parallelize_moe` and `parallelize_llama` take
</code_context>
<issue_to_address>
**Mesh exit ruled out prematurely**
When the q and k/v placement layouts have equal axes but different partition specs, the write-up treats equal axis sets as identical resolver input and rules out `resolved_mesh is None`, even though the q and k/v layouts differ in `partition_spec`; readers are told to eliminate a cause that remains possible.
Compare the complete placement layouts and verify the actual resolver result before ruling out the `resolved_mesh is None` exit.
</issue_to_address>check_doc_links.sh: case-sensitive lookup, titled links ('', "", ()),
#fragment checked against GitHub heading slugs, unreadable dirs fail
the run, external URLs skipped in the path scans. Count on current
ezpz goes 51 -> 71; the 20 new ones are broken heading links.
moe-tp2-wo-placement.md: resolved_mesh exit is open, not eliminated
(only axis sets were compared). Snippet uses cfg.model and is marked
as a 2026-08 record; it no longer runs after the October sync.
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.
Pulls the two pieces of #15 that exist nowhere else before that PR is closed.
moe-tp2-wo-placement.md: the TP>1 early-return diagnosis (81ccd98b,683acaf4), applied atguides/known-bugs/instead of the reorg'sreference/known-bugs/.scripts/check_doc_links.sh: link checker. On currentezpzit reports 51 dangling references (code->docs and docs->docs). Not wired into CI.No code changes.
Summary by Sourcery
Restore the MoE TP>1 diagnosis and add safeguards for stale documentation references across the ezpz experiment.
New Features:
Bug Fixes:
Enhancements:
Documentation: