Skip to content

Commit 38af329

Browse files
authored
fix(misc): migrate BERT conversion example to scripts/conversion/convert.sh (#6332)
Signed-off-by: Pruthviraj Prakash <pruprakash@nvidia.com>
1 parent 61682ab commit 38af329

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎examples/models/bert/megatron-bert/conversion.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ MODEL_NAME=megatron-bert-uncased-345m
2323
# Hub repo. See README.md for how to obtain one.
2424
HF_MODEL_PATH=${HF_MODEL_PATH:-"${WORKSPACE}/models/${MODEL_NAME}-hf"}
2525

26-
uv run python examples/conversion/convert_checkpoints.py import \
26+
./scripts/conversion/convert.sh import \
2727
--hf-model "$HF_MODEL_PATH" \
2828
--megatron-path "${WORKSPACE}/models/${MODEL_NAME}"
2929

30-
uv run python examples/conversion/convert_checkpoints.py export \
30+
./scripts/conversion/convert.sh export \
3131
--hf-model "$HF_MODEL_PATH" \
3232
--megatron-path "${WORKSPACE}/models/${MODEL_NAME}/iter_0000000" \
3333
--hf-path "${WORKSPACE}/models/${MODEL_NAME}-hf-export"

‎tests/unit_tests/doc_consistency/test_readme_consistency.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,17 @@ def test_shell_conversion_launcher_is_not_run_through_python():
204204
assert not offenders, f"convert.sh is invoked through Python or torchrun: {offenders}"
205205

206206

207+
def test_model_example_scripts_reference_existing_conversion_scripts():
208+
"""Every examples/conversion/*.py path in a model example shell script exists in the repo."""
209+
offenders: list[str] = []
210+
for path in sorted((REPO_ROOT / "examples" / "models").rglob("*.sh")):
211+
for ref in sorted(set(re.findall(r"examples/conversion/[\w./-]+\.py", _read(path)))):
212+
if not (REPO_ROOT / ref).is_file():
213+
offenders.append(f"{path.relative_to(REPO_ROOT)}: {ref}")
214+
215+
assert not offenders, f"model example scripts reference missing conversion scripts: {offenders}"
216+
217+
207218
def test_llama_readme_gptdataset_field_name():
208219
"""The GPTDatasetConfig YAML block uses the canonical field name (bug 4)."""
209220
# Bridge exposes seq_length and copies it to MCore's internal sequence_length during finalization.

0 commit comments

Comments
 (0)