Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit c9d9587

Browse files
andy-neumaandy-neuma
and
andy-neuma
authored
updates for nm-magic-wand, nightly or release (#247) (#248)
SUMMARY: * update GHA action `nm-build-vllm` to not install `nm-magic-wand-nightly` * update build script to not install `nm-magic-wand-nightly` (we might consider getting rid of this script altogether, since we aren't really using it) * remove unused GHA action `nm-test-vllm`. this has been superseded by `nm-install-test-whl` * update GHA action `nm-install-test-whl` to get version of `nm-magic-wand` if `nm-magic-wand-nightly` is not present * update `setup.py` to default generate "nightly" package and add option based on ENV to generate release package. this also includes managing the dependency on `nm-magic-wand`. * update `set-env` action to set ENV based on `wf_category` input * update "release" workflow to include all supported python versions * delete obsolete "gen-whl" NOTES: - "magic-wand" is only a runtime dependency, so no need to install it during build phase. - this PR makes it so that we by default generate a "nightly" package with a "nightly" version number. if we want to generate a release package we'll need to specify `wf_category` as `RELEASE`. TEST PLAN: runs on remote push. verifying that `wf_category` set to `RELEASE` will generate appropriate package. ran "build" workflow with `wf_category` set to `RELEASE` ... package looks properly named and versioned ... https://github.com/neuralmagic/nm-vllm/actions/runs/9129675592 the "remote push" defaulted to generating a "nightly" package ... please see ... https://github.com/neuralmagic/nm-vllm/actions/runs/9129665988 Co-authored-by: andy-neuma <[email protected]>
1 parent 9ea5c95 commit c9d9587

File tree

10 files changed

+107
-86
lines changed

10 files changed

+107
-86
lines changed

.github/actions/nm-build-vllm/action.yml

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ runs:
3232
VENV="${{ inputs.venv }}-${COMMIT:0:7}"
3333
source $(pyenv root)/versions/${{ inputs.python }}/envs/${VENV}/bin/activate
3434
# TODO: adjust when we need a proper release. use nightly now.
35-
pip3 install nm-magic-wand-nightly
3635
pip3 install -r requirements-cuda.txt -r requirements-build.txt
3736
# build
3837
SUCCESS=0

.github/actions/nm-install-test-whl/action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ runs:
5252
pip3 install ${WHL}[sparse]
5353
# report magic_wand version
5454
MAGIC_WAND=$(pip3 show nm-magic-wand-nightly | grep "Version" | cut -d' ' -f2)
55+
if [ -z "${MAGIC_WAND}" ]; then
56+
MAGIC_WAND=$(pip3 show nm-magic-wand | grep "Version" | cut -d' ' -f2)
57+
fi
5558
echo "magic_wand=${MAGIC_WAND}" >> "$GITHUB_OUTPUT"
5659
# test and collect code coverage
5760
SUCCESS=0

.github/actions/nm-set-env/action.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: set neuralmagic env
22
description: 'sets environment variables for neuralmagic'
33
inputs:
4+
wf_category:
5+
description: "categories: REMOTE, NIGHTLY, RELEASE"
6+
required: true
47
hf_token:
58
description: 'Hugging Face home'
69
required: true
@@ -14,19 +17,27 @@ runs:
1417
using: composite
1518
steps:
1619
- run: |
20+
# setup.py defaults to making 'nightly' package with 'nightly' version
21+
if [[ "${{inputs.wf_category}}" == "RELEASE" ]]; then
22+
echo "NM_RELEASE_TYPE=${{inputs.wf_category}}" >> $GITHUB_ENV
23+
fi
24+
# CUDA
1725
echo "TORCH_CUDA_ARCH_LIST=7.0 7.5 8.0 8.6 8.9 9.0+PTX" >> $GITHUB_ENV
26+
echo "PATH=/usr/local/apps/pyenv/plugins/pyenv-virtualenv/shims:/usr/local/apps/pyenv/shims:/usr/local/apps/pyenv/bin:/usr/local/apps/nvm/versions/node/v19.9.0/bin:/usr/local/apps/nvm/versions/node/v16.20.2/bin:/usr/local/cuda-12.1/bin:/usr/local/cuda-12.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/${WHOAMI}/.local/bin:" >> $GITHUB_ENV
27+
echo "LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64::/usr/local/cuda-12.1/lib64:" >> $GITHUB_ENV
28+
# HF Cache
1829
echo "HF_TOKEN=${HF_TOKEN_SECRET}" >> $GITHUB_ENV
1930
echo "HF_HOME=/EFS/hf_home" >> $GITHUB_ENV
31+
# build
2032
NUM_THREADS=$(./.github/scripts/determine-threading -G ${{ inputs.Gi_per_thread }})
2133
echo "MAX_JOBS=${NUM_THREADS}" >> $GITHUB_ENV
2234
echo "NVCC_THREADS=${{ inputs.nvcc_threads }}" >> $GITHUB_ENV
2335
echo "VLLM_INSTALL_PUNICA_KERNELS=1" >> $GITHUB_ENV
2436
echo "NCCL_IGNORE_DISABLED_P2P=1" >> $GITHUB_ENV
37+
# pyenv
2538
echo "PYENV_ROOT=/usr/local/apps/pyenv" >> $GITHUB_ENV
39+
# testmo
2640
echo "XDG_CONFIG_HOME=/usr/local/apps" >> $GITHUB_ENV
27-
WHOAMI=$(whoami)
28-
echo "PATH=/usr/local/apps/pyenv/plugins/pyenv-virtualenv/shims:/usr/local/apps/pyenv/shims:/usr/local/apps/pyenv/bin:/usr/local/apps/nvm/versions/node/v19.9.0/bin:/usr/local/apps/nvm/versions/node/v16.20.2/bin:/usr/local/cuda-12.1/bin:/usr/local/cuda-12.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/${WHOAMI}/.local/bin:" >> $GITHUB_ENV
29-
echo "LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64::/usr/local/cuda-12.1/lib64:" >> $GITHUB_ENV
3041
echo "PROJECT_ID=12" >> $GITHUB_ENV
3142
env:
3243
HF_TOKEN_SECRET: ${{ inputs.hf_token }}

.github/actions/nm-test-vllm/action.yml

-43
This file was deleted.

.github/scripts/build

+1-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ usage() {
66
echo
77
echo "usage: ${0} <options>"
88
echo
9-
echo " -a - pypi server address"
109
echo " -p - python version"
1110
echo " -v - name for virtualenv"
1211
echo " -h - this list of options"
@@ -17,15 +16,12 @@ PYPI_IP=
1716
PYTHON=
1817
VENV=
1918

20-
while getopts "ha:p:v:" OPT; do
19+
while getopts "hp:v:" OPT; do
2120
case "${OPT}" in
2221
h)
2322
usage
2423
exit 1
2524
;;
26-
a)
27-
PYPI_IP="${OPTARG}"
28-
;;
2925
p)
3026
PYTHON="${OPTARG}"
3127
;;
@@ -36,12 +32,6 @@ while getopts "ha:p:v:" OPT; do
3632
done
3733

3834
# check if variables are valid
39-
if [ -z "${PYPI_IP}" ]; then
40-
echo "please provide 'pypi' server address"
41-
usage
42-
exit 1
43-
fi
44-
4535
if [ -z "${PYTHON}" ]; then
4636
echo "please provide python version, e.g. 3.10.12"
4737
usage
@@ -55,6 +45,5 @@ if [ -z "${VENV}" ]; then
5545
fi
5646

5747
source $(pyenv root)/versions/${PYTHON}/envs/${VENV}/bin/activate
58-
pip3 install --index-url http://${PYPI_IP}:8080/ --trusted-host ${PYPI_IP} nm-magic-wand-nightly
5948
pip3 install -r requirements-cuda.txt -r requirements-build.txt
6049
pip3 install -e .

.github/workflows/build-test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ jobs:
116116
BUILD:
117117
uses: ./.github/workflows/build.yml
118118
with:
119+
wf_category: ${{ inputs.wf_category }}
119120
build_label: ${{ inputs.build_label }}
120121
timeout: ${{ inputs.build_timeout }}
121122
gitref: ${{ github.ref }}

.github/workflows/build.yml

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
# makes workflow reusable
44
workflow_call:
55
inputs:
6+
wf_category:
7+
description: "categories: REMOTE, NIGHTLY, RELEASE"
8+
type: string
9+
default: "REMOTE"
610
build_label:
711
description: "requested runner label (specifies instance)"
812
type: string
@@ -31,6 +35,10 @@ on:
3135
# makes workflow manually callable
3236
workflow_dispatch:
3337
inputs:
38+
wf_category:
39+
description: "categories: REMOTE, NIGHTLY, RELEASE"
40+
type: string
41+
default: "REMOTE"
3442
build_label:
3543
description: "requested runner label (specifies instance)"
3644
type: string
@@ -83,6 +91,7 @@ jobs:
8391
id: setenv
8492
uses: ./.github/actions/nm-set-env/
8593
with:
94+
wf_category: ${{ inputs.wf_category }}
8695
hf_token: ${{ secrets.NM_HF_TOKEN }}
8796
Gi_per_thread: ${{ inputs.Gi_per_thread }}
8897
nvcc_threads: ${{ inputs.nvcc_threads }}

.github/workflows/gen-whl.yml

-25
This file was deleted.

.github/workflows/release.yml

+55-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,43 @@ concurrency:
1717

1818
jobs:
1919

20-
BUILD-TEST:
20+
PYTHON-3-8:
21+
uses: ./.github/workflows/build-test.yml
22+
with:
23+
wf_category: 'RELEASE'
24+
python: 3.8.17
25+
gitref: ${{ github.ref }}
26+
27+
test_label_solo: aws-avx2-32G-a10g-24G
28+
test_label_multi: aws-avx2-192G-4-a10g-96G
29+
test_timeout: 480
30+
test_skip_list: neuralmagic/tests/skip-for-release.txt
31+
32+
benchmark_label: aws-avx2-32G-a10g-24G
33+
benchmark_config_list_file: ./.github/data/nm_benchmark_nightly_configs_list.txt
34+
benchmark_timeout: 180
35+
push_benchmark_results_to_gh_pages: ${{ inputs.push_benchmark_results_to_gh_pages }}
36+
secrets: inherit
37+
38+
PYTHON-3-9:
39+
uses: ./.github/workflows/build-test.yml
40+
with:
41+
wf_category: 'RELEASE'
42+
python: 3.9.17
43+
gitref: ${{ github.ref }}
44+
45+
test_label_solo: aws-avx2-32G-a10g-24G
46+
test_label_multi: aws-avx2-192G-4-a10g-96G
47+
test_timeout: 480
48+
test_skip_list: neuralmagic/tests/skip-for-release.txt
49+
50+
benchmark_label: aws-avx2-32G-a10g-24G
51+
benchmark_config_list_file: ./.github/data/nm_benchmark_nightly_configs_list.txt
52+
benchmark_timeout: 180
53+
push_benchmark_results_to_gh_pages: ${{ inputs.push_benchmark_results_to_gh_pages }}
54+
secrets: inherit
55+
56+
PYTHON-3-10:
2157
uses: ./.github/workflows/build-test.yml
2258
with:
2359
wf_category: 'RELEASE'
@@ -34,3 +70,21 @@ jobs:
3470
benchmark_timeout: 180
3571
push_benchmark_results_to_gh_pages: ${{ inputs.push_benchmark_results_to_gh_pages }}
3672
secrets: inherit
73+
74+
PYTHON-3-11:
75+
uses: ./.github/workflows/build-test.yml
76+
with:
77+
wf_category: 'RELEASE'
78+
python: 3.11.4
79+
gitref: ${{ github.ref }}
80+
81+
test_label_solo: aws-avx2-32G-a10g-24G
82+
test_label_multi: aws-avx2-192G-4-a10g-96G
83+
test_timeout: 480
84+
test_skip_list: neuralmagic/tests/skip-for-release.txt
85+
86+
benchmark_label: aws-avx2-32G-a10g-24G
87+
benchmark_config_list_file: ./.github/data/nm_benchmark_nightly_configs_list.txt
88+
benchmark_timeout: 180
89+
push_benchmark_results_to_gh_pages: ${{ inputs.push_benchmark_results_to_gh_pages }}
90+
secrets: inherit

setup.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# UPSTREAM SYNC: noqa is required for passing ruff.
33
# This file has been modified by Neural Magic
44

5+
import datetime
56
import importlib.util
67
import io
78
import logging
@@ -306,9 +307,28 @@ def find_version(filepath: str) -> str:
306307
raise RuntimeError("Unable to find version string.")
307308

308309

310+
# Neuralmagic packaging ENV's
311+
NM_RELEASE_TYPE = 'NM_RELEASE_TYPE'
312+
313+
314+
def get_nm_vllm_package_name() -> str:
315+
nm_release_type = os.getenv(NM_RELEASE_TYPE)
316+
package_name = None
317+
if nm_release_type == 'RELEASE':
318+
package_name = 'nm-vllm'
319+
else:
320+
package_name = 'nm-vllm-nightly'
321+
return package_name
322+
323+
309324
def get_vllm_version() -> str:
310325
version = find_version(get_path("vllm", "__init__.py"))
311326

327+
nm_release_type = os.getenv(NM_RELEASE_TYPE)
328+
if nm_release_type != 'RELEASE':
329+
date = datetime.date.today().strftime("%Y%m%d")
330+
version += f'.{date}'
331+
312332
if _is_cuda():
313333
cuda_version = str(get_nvcc_cuda_version())
314334
if cuda_version != MAIN_CUDA_VERSION:
@@ -393,6 +413,9 @@ def _read_requirements(filename: str) -> List[str]:
393413

394414
# UPSTREAM SYNC: needed for sparsity
395415
_sparsity_deps = ["nm-magic-wand-nightly"]
416+
nm_release_type = os.getenv(NM_RELEASE_TYPE)
417+
if nm_release_type == 'RELEASE':
418+
_sparsity_deps = ["nm-magic-wand"]
396419

397420
package_data = {
398421
"vllm": ["py.typed", "model_executor/layers/fused_moe/configs/*.json"]
@@ -402,7 +425,7 @@ def _read_requirements(filename: str) -> List[str]:
402425
package_data["vllm"].append("*.so")
403426

404427
setup(
405-
name="nm-vllm",
428+
name=get_nm_vllm_package_name(),
406429
version=get_vllm_version(),
407430
author="vLLM Team, Neural Magic",
408431
author_email="[email protected]",

0 commit comments

Comments
 (0)