Skip to content

Add empty cpu/gpu/training extras_require slots (Phase 4) - #1196

Closed
Shi-Dong wants to merge 1 commit into
shi/pin-megatron-bridge-shafrom
shi/phase4-extras-require-inventory
Closed

Add empty cpu/gpu/training extras_require slots (Phase 4)#1196
Shi-Dong wants to merge 1 commit into
shi/pin-megatron-bridge-shafrom
shi/phase4-extras-require-inventory

Conversation

@Shi-Dong

Copy link
Copy Markdown
Contributor

Summary

  • Add three empty placeholder slots to setup.py's extras_require: cpu, gpu, training. Each one is documented inline so the intent is obvious to future contributors.
  • No runtime change yet (slots are empty lists). The full categorization is in the audit table below; populating the lists is Phase 6's job, after the patched-fork wheels exist (Phase 5).

Why

The pip install miles roadmap (Phase 4) calls for declaring the extras_require taxonomy now so:

  1. Future commits that populate it land in well-named slots without bikeshedding.
  2. A user can already type pip install miles[gpu] and not get a KeyError on the typo — they just get the install_requires baseline (same as no extras), and the dependency list grows transparently as Phases 5–6 land.
  3. The setup.py inline comments serve as the single source of truth for "what goes where", removing the ambiguity that scattered comments across Dockerfile / requirements.txt / docs would create.

Phase 4 audit: where each current install lands

Already in install_requires (from requirements.txt)

20 packages — these are the always-installed dependencies of miles. All install cleanly from PyPI without a CUDA toolchain.

Package Notes
accelerate Brings in torch transitively (key for the eventual CPU path).
blobfile, datasets, httpx[http2], mcp[cli], memray, omegaconf, pillow, pybase64, pylatexenc, pytest-asyncio, pyyaml, qwen_vl_utils, tensorboard, transformers, wandb Standard PyPI installs.
ray[default] Pure-Python; runs on CPU and GPU.
ring_flash_attn; platform_system == "Linux" Conditionally Linux-only. Importable on CPU but exercises GPU code paths.
sglang-router>=0.2.3 Pure-Python router; today comes from a radixark/sgl-router-for-miles pre-built wheel in the image, also published to PyPI.
torchft-nightly==2026.4.3; platform_system == "Linux" Linux-only nightly.

extras_require["gpu"] — heavy GPU stack (Phase 6 target)

Today installed by docker/Dockerfile, not setup.py. Each needs CUDA toolchain at install time, a matching torch version, or a pre-built wheel.

Source Notes
flash-attn Pre-built wheel from yueming-yuan/miles-wheels release. Build-from-source is multi-hour.
flash-attn-3 (hopper) Hopper-only (sm_90a). Pre-built wheel + sources flash_attn_interface.py from Dao-AILab/flash-attention raw.
flash-linear-attention==0.4.2 PyPI.
tilelang Nightly from https://tile-ai.github.io/whl/nightly/cu128/.
causal-conv1d==1.6.1 PyPI, CUDA source build.
mamba-ssm==2.3.1 PyPI, CUDA source build.
transformer_engine[pytorch]==2.10.0 / transformer_engine==2.12.0 + transformer_engine_cu13 PyPI, CUDA build. ENABLE_CUDA_13 branch in Dockerfile picks variants.
apex Pre-built wheel; from-source typically requires manual NVCC env.
nvidia-modelopt[torch]>=0.37.0 PyPI, CUDA.
torch_memory_saver (fzyzcjy/torch_memory_saver @ pinned SHA) git+url today; eventually point at a stable wheel or pin via a Phase-3-style build arg.
mbridge (ISEEKYAN/mbridge @ pinned SHA) Same situation as torch_memory_saver.
nvidia-cudnn-cu12==9.16.0.29 or cu13 PyPI. CUDA-version-specific.
numpy<2 Post-install pin needed for Megatron compatibility. Belongs in install_requires once we figure out the proper version constraint.

extras_require["training"] — full training stack (Phase 5 + 6 target)

Everything in gpu plus the patched forks. These don't exist on PyPI yet; Phase 5 publishes them to a private index.

Source Notes
radixark-sglang (from third_party/sglang) Published from the submodule on submodule pointer bump. Eventual name TBD.
radixark-megatron (from third_party/Megatron-LM) Published from the submodule.
radixark-megatron-bridge (Phase 3-pinned SHA) Currently pip install git+...@<sha> in Dockerfile; Phase 6 may switch to a published wheel for symmetry.

Docker-only / vendor-built / system-level (not exposed via pip)

What Why we leave it alone
apt install nvtop rsync dnsutils ethtool System-level diagnostics, not Python deps.
nccl-tests (built from NVIDIA/nccl-tests source) System binary in /usr/local/bin/.
int4_qat (fake_int4_quant_cuda wheel) Custom-built wheel; users get it from the image.
sgl-model-gateway binary Rust-built native binary. Goes in /usr/local/bin/.
sglang_router wheel Has both a pre-built wheel path and a Rust-source path. The PyPI version is in install_requires; the image-specific wheel handles edge cases.

extras_require["cpu"]

Currently empty. Likely stays empty or gets minor additions for things like docstring-rendering, pretty CLI, etc. that aren't worth bloating install_requires for. Will revisit in Phase 6 once we know what the CPU-only entry point needs.

Test plan

  • python3 -c 'import ast; ast.parse(open("setup.py").read())' — syntax OK.
  • On a fresh python:3.11 container: pip install miles[cpu] — should succeed (against an empty list — equivalent to pip install miles for now).
  • This PR is intentionally a no-op for runtime; the meaningful tests come once Phase 5 lands and Phase 6 fills the slots.

Stacked on

radixark/miles PR #1194 (Phase 3: pin Megatron-Bridge SHA). Once that merges, this PR's base auto-updates.

What's NOT in this PR

  • No new extras_require entries with actual packages — that's Phase 6 (after the patched-fork wheels exist).
  • No CI / Dockerfile changes — those depend on Phase 6 too.
  • No new doc files — keeping the audit in the PR description rather than committing a .md to the repo.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds placeholder extra requirements (cpu, gpu, and training) to setup.py as part of the roadmap for pip install miles. These placeholders are currently empty and will be populated in future phases. There are no review comments, and I have no feedback to provide.

@Shi-Dong
Shi-Dong marked this pull request as ready for review May 28, 2026 06:50
@Shi-Dong
Shi-Dong force-pushed the shi/pin-megatron-bridge-sha branch from c614953 to 2d6ece2 Compare May 30, 2026 08:17
@Shi-Dong
Shi-Dong requested a review from yushengsu-thu as a code owner May 30, 2026 08:17
@Shi-Dong
Shi-Dong force-pushed the shi/phase4-extras-require-inventory branch 2 times, most recently from a458463 to ef8c861 Compare June 1, 2026 16:12
@Shi-Dong
Shi-Dong force-pushed the shi/pin-megatron-bridge-sha branch from 2d6ece2 to 9cbd212 Compare June 1, 2026 16:12
@Shi-Dong
Shi-Dong force-pushed the shi/phase4-extras-require-inventory branch from ef8c861 to 51fee7e Compare June 2, 2026 04:40
@Shi-Dong
Shi-Dong force-pushed the shi/pin-megatron-bridge-sha branch 2 times, most recently from cca1c14 to 4f82d4b Compare June 2, 2026 09:07
@Shi-Dong
Shi-Dong force-pushed the shi/phase4-extras-require-inventory branch from 51fee7e to 518d340 Compare June 2, 2026 09:07
@Shi-Dong
Shi-Dong force-pushed the shi/pin-megatron-bridge-sha branch from 4f82d4b to d190a0b Compare June 3, 2026 15:02
@Shi-Dong
Shi-Dong force-pushed the shi/phase4-extras-require-inventory branch from 518d340 to 6ee0b3f Compare June 3, 2026 15:02
Phase 4 of the `pip install miles` roadmap: declare the structure of
the extras_require taxonomy without populating it yet. Phase 6 will
fill the gpu/training slots with the heavy GPU stack (flash-attn,
transformer-engine, apex, mamba, etc.) that today lives in
docker/Dockerfile.

The slots are documented inline so future contributors know what
belongs where. No runtime change — `pip install miles[cpu]` is a
no-op against the empty list, but the syntax is now valid (won't
KeyError on a typo) and the PR description includes the full audit
of Dockerfile + requirements.txt that informed the categorization.

Pre-existing extras (`fsdp`, `mlflow`) are left untouched.
@Shi-Dong
Shi-Dong force-pushed the shi/phase4-extras-require-inventory branch from 6ee0b3f to db6b4d4 Compare June 4, 2026 13:10
@Shi-Dong

Copy link
Copy Markdown
Contributor Author

Closing as obsolete. This PR is superseded by a thin packaging slice cut fresh off current `main`:

  • radixark/miles#PRA — re-add `third_party/sglang` + `third_party/Megatron-LM` submodules
  • radixark/miles#PRB — `setup.py` bundling + `publish-pypi.yml` + `miles-rl` 0.0.3

Why this one is no longer needed: see the per-PR note below. The branch is left in place; nothing is lost.

@Shi-Dong Shi-Dong closed this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant