Move slime + Megatron-LM sources to /opt for non-root AML jobs#5046
Merged
Conversation
The slime curated image (slime-pytorch-2.9-cuda12.8:2) was unusable by Foundry/Vienna Training Block Slime SFT jobs running on AML/Singularity as uid 9000 (aiscuser). The Dockerfile cloned slime into /root/slime and Megatron-LM into /root/Megatron-LM, then pip installed each editably. Because /root is mode 700, the non-root job user could not: - read /root/slime/train.py or /root/slime/slime/__init__.py - resolve import slime (the editable .pth points into /root/slime) - pick up Megatron-LM via PYTHONPATH=/root/Megatron-LM - run python train.py ... (no readable entrypoint) Passing esources.dockerArgs="--user root" was not a viable workaround because the AML job still launches as aiscuser regardless. Relocate both editable trees to /opt: - Clone slime into /opt/slime and Megatron-LM into /opt/Megatron-LM. - Update the Megatron patch path, both pip install -e invocations, and the int4_qat in-tree install to use /opt/slime. - Update PYTHONPATH and WORKDIR to /opt. - chmod -R a+rX /opt/slime /opt/Megatron-LM so a defensive umask cannot strip world read+traverse from the source trees. Validation additions: - smoke_test.py now asserts that slime.__file__ resolves under /opt/slime, and that /opt/slime, /opt/slime/train.py, /opt/slime/slime/__init__.py, and /opt/Megatron-LM are world-readable and (for directories) world-traversable. - The build now also runs unuser -u nobody -- python against an importlib-based slime import check, giving end-to-end confidence that a non-root user can import slime before the image is published. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Test Results for assets-test0 tests 0 ✅ 0s ⏱️ Results for commit 7ec0911. ♻️ This comment has been updated with latest results. |
yeshsurya
previously approved these changes
May 15, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
vizhur
approved these changes
May 18, 2026
This was referenced May 20, 2026
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.
Why
The slime curated image
mcr.microsoft.com/azureml/curated/slime-pytorch-2.9-cuda12.8:2is unusable from Foundry/Vienna Training Block Slime SFT jobs because AML/Singularity runs the job asuid=9000(aiscuser), but/rootis mode700. Source files like/root/slime/train.pyand/root/slime/slime/__init__.pyraisePermissionError,importlib.util.find_spec(""slime"")fails, and there is no readabletrain.pyfor the compiled command. Passingresources.dockerArgs=""--user root""is not a viable workaround — the actual job still runs asaiscuser.What
Relocate the editable Slime + Megatron-LM trees from
/rootto/opt(mode755) so non-root jobs can read them.slimeto/opt/slime,Megatron-LMto/opt/Megatron-LM.pip install -einvocations, theint4_qatin-tree install,WORKDIR, andPYTHONPATHto/opt.chmod -R a+rX /opt/slime /opt/Megatron-LMso a defensive umask cannot strip world read+traverse.Validation in the image
smoke_test.pynow assertsslime.__file__resolves under/opt/slimeand that/opt/slime,/opt/slime/train.py,/opt/slime/slime/__init__.py, and/opt/Megatron-LMare world-readable and (for directories) world-traversable.runuser -u nobody -- pythoncheck thatimport slimeandimportlib.util.find_spec(""slime"")succeed.Acceptance criteria addressed
python -c ""import slime""succeeds from a non-root user.python /opt/slime/train.py(orcd /opt/slime && python train.py) is accessible —train.pyis now world-readable.PermissionErroror missingtrain.py.Compatibility note
Any customer command that assumed
/root/slimewill need to point at/opt/slimeinstead. The image version will bump on merge.