[docker, CI] use radixark/Megatron-LM' and allow specify sglang/megatron PR in CI#620
[docker, CI] use radixark/Megatron-LM' and allow specify sglang/megatron PR in CI#620yueming-yuan merged 13 commits intomainfrom
Conversation
Summary of ChangesHello @yueming-yuan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the Dockerfile responsible for setting up the development environment. The primary goal is to move away from maintaining and applying a custom patch for Megatron-LM, instead opting for direct integration with a specific branch of an external repository. This change simplifies dependency management by utilizing pre-built wheels and standardizing the installation of various deep learning libraries, leading to a more robust and easier-to-maintain build process. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly simplifies the Dockerfile by replacing the megatron.patch with a direct dependency on a forked radixark/Megatron-LM repository. This is a great improvement for maintainability. The changes also refactor the installation of Python dependencies, using pre-built wheels more effectively and cleaning up the logic for different CUDA versions. The new method for downloading all wheels from a GitHub release in one step is particularly clever. I have one suggestion to improve the readability and robustness of the Python script used for downloading the wheels.
| | python3 -c "import sys, json, subprocess; \ | ||
| [subprocess.run(['curl', '-fSL', '-o', '/tmp/wheels/' + a['name'], a['browser_download_url']], check=True) \ | ||
| for a in json.load(sys.stdin)['assets'] if a['name'].endswith('.whl')]" && \ |
There was a problem hiding this comment.
This Python one-liner is a bit dense and has a couple of potential issues:
- It will fail with a
KeyErrorif the GitHub API response for the release does not contain anassetskey. Using.get('assets', [])would be more robust. - Using a list comprehension for its side effects (calling
subprocess.run) is not idiomatic Python. Aforloop is more explicit and readable.
Consider refactoring this into a multi-line script within the RUN command for better readability and maintainability, for example:
import sys, json, subprocess
release_data = json.load(sys.stdin)
for asset in release_data.get('assets', []):
if asset['name'].endswith('.whl'):
url = asset['browser_download_url']
filename = '/tmp/wheels/' + asset['name']
print(f"Downloading {url} to {filename}")
subprocess.run(['curl', '-fSL', '-o', filename, url], check=True)
ci-megatron-pr: #11
ci-sglang-pr: sglang-miles