Skip to content

[ckpt, model] refactor: remove unused helper functions#3879

Open
yaoyu-33 wants to merge 2 commits into
mainfrom
audit/src-api-cleanup-20260519
Open

[ckpt, model] refactor: remove unused helper functions#3879
yaoyu-33 wants to merge 2 commits into
mainfrom
audit/src-api-cleanup-20260519

Conversation

@yaoyu-33
Copy link
Copy Markdown
Contributor

@yaoyu-33 yaoyu-33 commented May 19, 2026

Summary

  • Remove unused is_tensor_parallel() from models/conversion/model_bridge.py.
  • Remove unused private _transpose_first_dim() from training/checkpointing.py.
  • Both helpers had no repo callers in src/megatron/bridge, tests, examples, docs, or scripts.

Usage evidence

  • git grep -n "is_tensor_parallel" -- src/megatron/bridge tests examples docs scripts "*.py" "*.md" only found the removed definition.
  • git grep -n "_transpose_first_dim\|num_splits_first" -- src/megatron/bridge tests examples docs scripts "*.py" "*.md" only found the removed private helper.
  • is_tensor_parallel() was not exported from models/__init__.py or models/conversion/__init__.py.

Validation

  • uv run --no-sync python -m py_compile src/megatron/bridge/models/conversion/model_bridge.py src/megatron/bridge/training/checkpointing.py
  • uv run --no-project --with ruff ruff check src/megatron/bridge/models/conversion/model_bridge.py src/megatron/bridge/training/checkpointing.py
  • uv run --no-project --with ruff ruff format --check src/megatron/bridge/models/conversion/model_bridge.py src/megatron/bridge/training/checkpointing.py
  • git diff --check origin/main...HEAD
  • uv run pre-commit run --all-files is blocked locally because uv cannot remove <local uv cache>/git-v0/db/f679917ede501d2d while resolving transformer-engine @ git+https://github.com/NVIDIA/TransformerEngine.git@release_v2.15 (Permission denied).

Unit tests were not run locally per dispatcher policy. This cleanup removes unreachable/uncalled helpers only.

Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 19, 2026

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.

@yaoyu-33
Copy link
Copy Markdown
Contributor Author

/ok to test f838e09

@yaoyu-33
Copy link
Copy Markdown
Contributor Author

Usage evidence for cleanup:

  • is_tensor_parallel() had no repo callers: git grep -n "is_tensor_parallel" -- src/megatron/bridge tests examples docs scripts "*.py" "*.md" found only the removed definition in model_bridge.py.
  • _transpose_first_dim() had no repo callers: git grep -n "_transpose_first_dim\|num_splits_first" -- src/megatron/bridge tests examples docs scripts "*.py" "*.md" found only the removed private helper in checkpointing.py.
  • is_tensor_parallel() was not exported from models/__init__.py or models/conversion/__init__.py; _transpose_first_dim() was private and undocumented.
  • Focused static validation passed; full pre-commit is blocked locally by a permission error in the uv cache while resolving TransformerEngine.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 19, 2026

LGTM — clean removal of two unused helpers (is_tensor_parallel and _transpose_first_dim). Verified zero callers across src/, tests/, examples/, scripts/, and docs/. Neither function was exported from any __init__.py.

Minor note: the PR body references a local path (/home/yuya/.cache/...) in the validation section — not in code, so no action needed, but worth redacting for hygiene.

Suggested test cases

No perf tests impacted.

@yaoyu-33 yaoyu-33 added area:ckpt Checkpoint conversion, loading, export, and save paths feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels May 19, 2026
@yaoyu-33
Copy link
Copy Markdown
Contributor Author

/ok to test e059f59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ckpt Checkpoint conversion, loading, export, and save paths feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant