fix: derive Megatron-LM PYTHONPATH from script location#3
Open
koriyoshi2041 wants to merge 1 commit intoGen-Verse:mainfrom
Open
fix: derive Megatron-LM PYTHONPATH from script location#3koriyoshi2041 wants to merge 1 commit intoGen-Verse:mainfrom
koriyoshi2041 wants to merge 1 commit intoGen-Verse:mainfrom
Conversation
The RUNTIME_ENV_JSON in both launch scripts hardcoded a placeholder
path `/absolute/path/to/OpenClaw-RL/Megatron-LM/` for the Megatron-LM
PYTHONPATH entry. Unlike HF_CKPT and other paths which use
`${VAR:-default}` syntax and are clearly marked as user-configurable,
this PYTHONPATH was embedded inside a JSON string and easy to miss,
causing import failures at runtime.
Compute MEGATRON_ROOT from the script's directory (same pattern as
SLIME_ROOT) so it resolves correctly regardless of where the
repository is cloned.
JasonOA888
added a commit
to JasonOA888/OpenClaw-RL
that referenced
this pull request
Mar 12, 2026
Fixes Gen-Verse#3 ## Summary - Replace hardcoded /absolute/path/to/OpenClaw-RL/Megatron-LM/ with dynamically computed MEGATRON_ROOT - Computes MEGATRON_ROOT using the same cd && pwd pattern as SLIME_ROOT ## Changes - openclaw-rl/run_qwen3_4b_openclaw_rl.sh - openclaw-opd/run_qwen3_4b_openclaw_opd.sh Each script now includes: ```bash MEGATRON_ROOT="$(cd -- "${SCRIPT_DIR}/../Megatron-LM" &>/dev/null && pwd)" ... "PYTHONPATH": "${MEGATRON_ROOT}:${SCRIPT_DIR}:${SLIME_ROOT}" ``` ## Test plan - [x] Verified SCRIPT_DIR/../Megatron-LM resolves correctly - [x] Pattern matches existing SLIME_ROOT computation - [x] Shell quoting correct in JSON string
2 tasks
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.
Summary
/absolute/path/to/OpenClaw-RL/Megatron-LM/inRUNTIME_ENV_JSON'sPYTHONPATHwith a dynamically computedMEGATRON_ROOTvariableUnlike
HF_CKPT,SAVE_CKPT, andPRM_MODEL_PATH— which use${VAR:-default}syntax and are clearly marked as user-configurable — this Megatron-LM path was embedded inside a JSON string and easy to overlook. Users who correctly set the model paths could still hit import failures because thisPYTHONPATHentry silently pointed to a non-existent placeholder directory.The fix computes
MEGATRON_ROOTusing the samecd && pwdpattern already established forSLIME_ROOT, so it resolves correctly regardless of where the repository is cloned.Files changed
openclaw-rl/run_qwen3_4b_openclaw_rl.shopenclaw-opd/run_qwen3_4b_openclaw_opd.shTest plan
SCRIPT_DIR/../Megatron-LMresolves to the correct sibling directorySLIME_ROOTcomputationPYTHONPATHresolution