Skip to content

docs(hy_worldplay/wan22): tighten AI-generated comments and docstrings#314

Merged
liruilong940607 merged 2 commits into
mainfrom
dev/wenqingw-nv/hy-worldplay-doc-cleanup
Jun 17, 2026
Merged

docs(hy_worldplay/wan22): tighten AI-generated comments and docstrings#314
liruilong940607 merged 2 commits into
mainfrom
dev/wenqingw-nv/hy-worldplay-doc-cleanup

Conversation

@wenqingw-nv

@wenqingw-nv wenqingw-nv commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Separate doc-cleanup pass requested by @liruilong940607 in the PR #224 review — trim the agent's chain-of-thought / historical narration from comments and docstrings across the HY-WorldPlay + wan22 integration (in the spirit of the omnidreams deslop, #292).

Per Ruilong's PR #224 request for a separate cleanup pass: trim the
agent's chain-of-thought and historical narration from comments and
docstrings across the HY-WorldPlay + wan22 integration, leaving tight,
user-facing docs plus one-line correctness invariants.

Comments and docstrings only -- zero executable-code changes (verified
by AST comparison with all string-literal statements stripped). CPU test
suite (93 passed) and ruff v0.12.7 format/import checks green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@copy-pr-bot

copy-pr-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Pure documentation cleanup across the HY-WorldPlay + wan22 integration: AI-generated chain-of-thought, historical narration, and vendor-code call-site references are trimmed from comments and docstrings. No executable code is changed.

  • Across _action.py, _camera.py, _checkpoint.py, config.py, runner.py: inline comments and docstrings shortened; most simplifications preserve the essential technical constraint while removing scaffolding text.
  • _prope.py, _memory.py, vae.py: three edits that lose non-obvious technical context are flagged in existing review threads (MIT attribution, remap direction, assertion over-shoot explanation); two further comment deletions in _action.py and _camera.py (stabilization-timestep derivation and norm1 affine-free rationale) are noted in new comments above.

Confidence Score: 5/5

Safe to merge — no executable code is touched; the changes are entirely documentation.

Every diff line is a comment, docstring, or string literal. The two new findings concern small but useful explanations that were deleted (the derivation of a magic constant and the rationale for a seemingly-redundant helper call); neither deletion will cause incorrect behaviour at runtime.

The five files that carry issues flagged in this review or prior threads — vae.py, _prope.py, _memory.py, _action.py, and _camera.py — are worth a final read-through before merging to decide whether any of the trimmed context should be partially restored.

Important Files Changed

Filename Overview
flashdreams/flashdreams/recipes/wan/autoencoder/vae.py Trimmed comments around the _WAN22_TI2V_5B_VAE_KEY_REMAP dict and wan22_ti2v_5b_vae_state_dict_transform; the new top-of-dict comment now describes the remap as "the production VAE load path," inverting the old claim that production configs use the .pth file (no remap) and the remap is an opt-in fallback for diffusers — already flagged in a prior thread.
integrations/hy_worldplay/hy_worldplay/_action.py Widespread docstring trimming; most simplifications are safe. The derivation stabilization_level − 1 = 14 for _HY_STABILIZATION_TIMESTEP was dropped, leaving the magic constant without an in-tree pointer to its origin.
integrations/hy_worldplay/hy_worldplay/_camera.py Docstring and comment reductions throughout; most are clean. The explanation that norm1 has elementwise_affine=False and _fp32_layer_norm is used purely for symmetry with other norm call sites was deleted, which could mislead a future maintainer into removing the helper at that call site.
integrations/hy_worldplay/hy_worldplay/_checkpoint.py Comment compression only; the 4-step checkpoint-transform pipeline is now documented more concisely but the key behaviour (envelope unwrap, prefix strip, base remap, HY-specific remap) is still clear.
integrations/hy_worldplay/hy_worldplay/_debug_dump.py Module docstring trimmed; the reference to the parallel vendor-side dump_patch.py monkey-patch was removed, but the diagnostic harness itself is unchanged.
integrations/hy_worldplay/hy_worldplay/_memory.py Comment and docstring simplifications; the explanation that the greedy extend(range(start, start+4)) loop can overshoot fov_budget by up to 3 — causing the assertion to fire on non-multiple-of-4 budgets — was removed (already flagged in a prior thread).
integrations/hy_worldplay/hy_worldplay/_pose.py Two short comment trims; no meaningful context lost.
integrations/hy_worldplay/hy_worldplay/_prope.py Module docstring lost the upstream repo URL, MIT-license attribution, and cross-reference to the validation test file integrations/hy_worldplay/tests/test_prope.py; the MIT attribution issue is already covered in a prior thread. Minor comment trimming elsewhere is clean.
integrations/hy_worldplay/hy_worldplay/config.py Comment compression in _build_hy_worldplay_pipeline; vendor file references (pipeline_wan_w_mem_relative_rope.py lines) removed but the logical rationale for each config value is preserved.
integrations/hy_worldplay/hy_worldplay/runner.py Module-level constant docstrings and inline comments trimmed; key behavioural caveats (no trailing period for UMT5, full-frame RNG draw for bit-alignment) are preserved in the shorter forms.
integrations/wan22/wan22/config.py Module docstring rewritten from a phase-deliverable narrative to a concise functional summary; _WAN22_TI2V_5B_DIT_KEY_REMAP block comment simplified. Both changes are purely editorial.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[HyWorldPlayWanI2VRunner.run] --> B[preprocess_first_frame]
    B --> C[encode first frame via VAE]
    C --> D[AR loop: for ar_idx in range num_chunk]
    D --> E{ar_idx == 0?}
    E -- yes --> F[pipeline.generate chunk 0\nno memory prefill]
    E -- no --> G[_prefill_memory_kv_cache\nslice clean-latent history\nbuild collapsed RoPE freqs\nfor each PRoPE block]
    G --> H[HyWorldPlayWanDiTNetwork.prefill_memory_kv\nwrites K/V into block cache.memory]
    H --> I[pipeline.generate chunk N\nforward_dual_branch prepends\nmemory K/V to rolling K/V]
    F --> J[pipeline.finalize\nappend clean latent to history\nadvance KV cache]
    I --> J
    J --> D
    D -- done --> K[decode chunks via VAE\nwrite mp4]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[HyWorldPlayWanI2VRunner.run] --> B[preprocess_first_frame]
    B --> C[encode first frame via VAE]
    C --> D[AR loop: for ar_idx in range num_chunk]
    D --> E{ar_idx == 0?}
    E -- yes --> F[pipeline.generate chunk 0\nno memory prefill]
    E -- no --> G[_prefill_memory_kv_cache\nslice clean-latent history\nbuild collapsed RoPE freqs\nfor each PRoPE block]
    G --> H[HyWorldPlayWanDiTNetwork.prefill_memory_kv\nwrites K/V into block cache.memory]
    H --> I[pipeline.generate chunk N\nforward_dual_branch prepends\nmemory K/V to rolling K/V]
    F --> J[pipeline.finalize\nappend clean latent to history\nadvance KV cache]
    I --> J
    J --> D
    D -- done --> K[decode chunks via VAE\nwrite mp4]
Loading

Reviews (2): Last reviewed commit: "Merge branch 'main' into dev/wenqingw-nv..." | Re-trigger Greptile

Comment on lines 17 to 20

Ports the bit pattern of ``hyvideo/prope/camera_rope.py::prope_qkv`` from
`PRoPE: Projective Positional Encoding for Multiview Transformers
<https://github.com/Tencent-Hunyuan/HY-WorldPlay/blob/main/hyvideo/prope/camera_rope.py>`_
(MIT-licensed) so the native HY-WorldPlay path can apply per-camera
projective transforms to Q/K/V before attention without importing the
upstream HY-WorldPlay tree at runtime.

The transform is a block-diagonal matrix multiply on the per-head feature
Applies per-camera projective transforms to Q/K/V before attention. The
transform is a block-diagonal matrix multiply on the per-head feature
axis: each camera's tokens get multiplied by a 4×4 matrix derived from

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 MIT attribution removed from ported code

The old module docstring explicitly stated this file "Ports the bit pattern of hyvideo/prope/camera_rope.py::prope_qkv from PRoPE: Projective Positional Encoding for Multiview Transformers (MIT-licensed)." The cleanup pass removed the upstream GitHub URL and the MIT-license callout entirely. Even though the file header carries Apache-2.0, the ported code originates from a distinct MIT-licensed third-party repository. Dropping the source URL and license notice makes it harder to trace provenance, reconcile against upstream changes, or satisfy any downstream audit that asks where the PRoPE math came from.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment thread flashdreams/flashdreams/recipes/wan/autoencoder/vae.py
Comment thread integrations/hy_worldplay/hy_worldplay/_memory.py

@liruilong940607 liruilong940607 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TY! Always love to see cleanups!

@liruilong940607

Copy link
Copy Markdown
Collaborator

/ok to test 6c58789

Signed-off-by: Ruilong Li(李瑞龙) <ruilongl@nvidia.com>
@liruilong940607

Copy link
Copy Markdown
Collaborator

/ok to test 8f41409

@liruilong940607 liruilong940607 added this pull request to the merge queue Jun 17, 2026
Merged via the queue into main with commit eb5e83a Jun 17, 2026
6 checks passed
@liruilong940607 liruilong940607 deleted the dev/wenqingw-nv/hy-worldplay-doc-cleanup branch June 17, 2026 00:26
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