MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / make_vllm_image

Function make_vllm_image

src/fused_mm_sampling/modal_lib/utils.py:65–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63VLLM_FORK_BRANCH = "feature/fmms-sampler"
64VLLM_FORK_SHA = "7a74973e4dc727df979f2a5ec9fff64ac5319467"
65# Upstream-main parent of the latest main-to-feature merge in VLLM_FORK_SHA.
66# Determine it with:
67# merge=$(git rev-list --first-parent --merges -n 1 "$VLLM_FORK_SHA")
68# git show -s --format='%P' "$merge" # use the second parent
69VLLM_PRECOMPILED_WHEEL_SHA = "1a2c17634eccc4e68d9e1ab654f702d55361c754"
70
71
72def make_vllm_image() -> modal.Image:
73 return (
74 # Base image must match vLLM's pinned torch version (see requirements/cuda.txt
75 # in the fork: torch==2.11.0). cuda13.0 is the newest CUDA tag pytorch/pytorch
76 # publishes for 2.11.0. Because vLLM pins torch without a local version, uv
77 # treats the base image's torch==2.11.0+cu130 as satisfying the pin and skips
78 # reinstalling, so we keep cu13 throughout and the precompiled .so stays ABI-
79 # compatible.
80 modal.Image.from_registry("pytorch/pytorch:2.11.0-cuda13.0-cudnn9-devel")
81 .apt_install("git", "curl")
82 .run_commands("pip install --break-system-packages uv")
83 .run_commands(
84 f"git clone --depth 1 -b {VLLM_FORK_BRANCH}"
85 " https://github.com/tomasruizt/vllm.git /opt/vllm"
86 " && cd /opt/vllm"
87 f" && git fetch --depth 1 origin {VLLM_FORK_SHA}"
88 f" && git checkout {VLLM_FORK_SHA}",
89 # Pre-install numpy at a vllm[bench]-compatible version before
90 # installing vllm. The base image ships numpy 2.4.3, but
91 # vllm[bench]'s deps (numba, mistral-common) need numpy<2.3.
92 # If we let uv downgrade during vllm install, it leaves a
93 # broken `numpy-2.4.3.dist-info` entry that makes
94 # importlib.metadata.version("numpy") return None, which
95 # aborts the vllm CLI on import.
96 "pip install --break-system-packages 'numpy<2.3'",
97 # Install build dependencies into the base environment because the
98 # precompiled build below deliberately disables isolation.
99 "uv pip install --system -r /opt/vllm/requirements/build.txt",
100 # Let vLLM's resolver pick the torch version that matches the precompiled .so.
101 # Earlier we pinned torch==2.10.0 to match a 2.10.0+cu130 .so, but the upstream
102 # precompiled wheel is now built against torch 2.11.0, so any pin breaks the ABI.
103 "cd /opt/vllm"
104 f" && VLLM_PRECOMPILED_WHEEL_COMMIT={VLLM_PRECOMPILED_WHEEL_SHA}"
105 " VLLM_USE_PRECOMPILED=1 uv pip install"
106 " --system --no-build-isolation '.[bench]'",
107 "test -f /usr/local/lib/python3.12/dist-packages/vllm/_C.abi3.so",
108 )
109 .add_local_dir(
110 str(_repo_root / "src"),
111 remote_path="/opt/fused-mm-sample/src",
112 copy=True,
113 ignore=["__pycache__", "*.pyc"],
114 )
115 .add_local_file(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected