Conversation
Add data_dir, model_dir, model_local_dir, save_dir, megatron_path as configurable dataclass fields with backward-compatible defaults, replacing all hardcoded /root/models, /root/datasets, /root/local_data, /root/shared_data, /root/Megatron-LM references across 5 scripts and command_utils.py.
Co-authored-by: Yueming Yuan <yym022502@gmail.com>
Summary of ChangesHello @fzyzcjy, 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 significantly improves the configurability and maintainability of several core Python scripts by externalizing previously hardcoded file system paths. By introducing dedicated fields within the Highlights
Changelog
Activity
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 PR aims to extract hardcoded /root/ paths into ScriptArgs fields for improved configurability, achieving this while maintaining backward compatibility. However, this introduces a critical command injection vulnerability. User-controllable inputs from ScriptArgs are used in shell commands executed via bash -c without proper sanitization (e.g., using shlex.quote()), making the application vulnerable. Additionally, consider using pathlib.Path for path concatenation instead of f-strings (e.g., Path(data_dir) / partial_name). This improves robustness, cross-platform compatibility, and maintainability, and a specific suggestion is provided in miles/utils/external_utils/command_utils.py.
- Rename save_dir -> output_dir for broader semantics (checkpoints, dump details, core dumps) - Move output_dir field from individual ScriptArgs to ExecuteTrainConfig so all scripts inherit it - Replace hardcoded /root/shared_data in CUDA_COREDUMP_FILE with config.output_dir
a56ec11 to
6a97efe
Compare
splitted from a co-worked branch