diff --git a/.github/actions/nm-build-vllm/action.yml b/.github/actions/nm-build-vllm/action.yml index c2cccf53b164d..fcc9003d65a97 100644 --- a/.github/actions/nm-build-vllm/action.yml +++ b/.github/actions/nm-build-vllm/action.yml @@ -32,7 +32,6 @@ runs: VENV="${{ inputs.venv }}-${COMMIT:0:7}" source $(pyenv root)/versions/${{ inputs.python }}/envs/${VENV}/bin/activate # TODO: adjust when we need a proper release. use nightly now. - pip3 install nm-magic-wand-nightly pip3 install -r requirements-cuda.txt -r requirements-build.txt # build SUCCESS=0 diff --git a/.github/actions/nm-install-test-whl/action.yml b/.github/actions/nm-install-test-whl/action.yml index 193dad8f99820..3cf42f72da974 100644 --- a/.github/actions/nm-install-test-whl/action.yml +++ b/.github/actions/nm-install-test-whl/action.yml @@ -52,6 +52,9 @@ runs: pip3 install ${WHL}[sparse] # report magic_wand version MAGIC_WAND=$(pip3 show nm-magic-wand-nightly | grep "Version" | cut -d' ' -f2) + if [ -z "${MAGIC_WAND}" ]; then + MAGIC_WAND=$(pip3 show nm-magic-wand | grep "Version" | cut -d' ' -f2) + fi echo "magic_wand=${MAGIC_WAND}" >> "$GITHUB_OUTPUT" # test and collect code coverage SUCCESS=0 diff --git a/.github/actions/nm-set-env/action.yml b/.github/actions/nm-set-env/action.yml index 66ad43fa2183e..d3a7b7f734ab0 100644 --- a/.github/actions/nm-set-env/action.yml +++ b/.github/actions/nm-set-env/action.yml @@ -1,6 +1,9 @@ name: set neuralmagic env description: 'sets environment variables for neuralmagic' inputs: + wf_category: + description: "categories: REMOTE, NIGHTLY, RELEASE" + required: true hf_token: description: 'Hugging Face home' required: true @@ -14,19 +17,27 @@ runs: using: composite steps: - run: | + # setup.py defaults to making 'nightly' package with 'nightly' version + if [[ "${{inputs.wf_category}}" == "RELEASE" ]]; then + echo "NM_RELEASE_TYPE=${{inputs.wf_category}}" >> $GITHUB_ENV + fi + # CUDA echo "TORCH_CUDA_ARCH_LIST=7.0 7.5 8.0 8.6 8.9 9.0+PTX" >> $GITHUB_ENV + 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 + echo "LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64::/usr/local/cuda-12.1/lib64:" >> $GITHUB_ENV + # HF Cache echo "HF_TOKEN=${HF_TOKEN_SECRET}" >> $GITHUB_ENV echo "HF_HOME=/EFS/hf_home" >> $GITHUB_ENV + # build NUM_THREADS=$(./.github/scripts/determine-threading -G ${{ inputs.Gi_per_thread }}) echo "MAX_JOBS=${NUM_THREADS}" >> $GITHUB_ENV echo "NVCC_THREADS=${{ inputs.nvcc_threads }}" >> $GITHUB_ENV echo "VLLM_INSTALL_PUNICA_KERNELS=1" >> $GITHUB_ENV echo "NCCL_IGNORE_DISABLED_P2P=1" >> $GITHUB_ENV + # pyenv echo "PYENV_ROOT=/usr/local/apps/pyenv" >> $GITHUB_ENV + # testmo echo "XDG_CONFIG_HOME=/usr/local/apps" >> $GITHUB_ENV - WHOAMI=$(whoami) - 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 - echo "LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64::/usr/local/cuda-12.1/lib64:" >> $GITHUB_ENV echo "PROJECT_ID=12" >> $GITHUB_ENV env: HF_TOKEN_SECRET: ${{ inputs.hf_token }} diff --git a/.github/actions/nm-test-vllm/action.yml b/.github/actions/nm-test-vllm/action.yml deleted file mode 100644 index fd96f4fc07af7..0000000000000 --- a/.github/actions/nm-test-vllm/action.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: test nm-vllm -description: "test nm-vllm via, 'pytest tests/'" -inputs: - test_skip_list: - description: 'file containing tests to skip' - required: true - test_directory: - description: 'test directory, path is relative to nm-vllm' - required: true - test_results: - description: 'top-level directory for xml test results' - required: true - python: - description: 'python version, e.g. 3.10.12' - required: true - venv: - description: 'name for python virtual environment' - required: true - pypi: - description: 'ip address for pypi server' - required: true -outputs: - status: - description: "final status from 'pytest tests/'" - value: ${{ steps.test.outputs.status }} -runs: - using: composite - steps: - - id: test - run: | - COMMIT=${{ github.sha }} - VENV="${{ inputs.venv }}-${COMMIT:0:7}" - source $(pyenv root)/versions/${{ inputs.python }}/envs/${VENV}/bin/activate - pip3 install --index-url http://${{ inputs.pypi }}:8080/ --trusted-host ${{ inputs.pypi }} nm-magic-wand-nightly - pip3 install -r requirements-dev.txt - pip3 install coverage - # run tests via runner script - SUCCESS=0 - ./.github/scripts/run-tests -t ${{ inputs.test_directory }} -r ${{ inputs.test_results }} -f ${{ inputs.test_skip_list }} || SUCCESS=$? - echo "was this a SUCCESS? ${SUCCESS}" - echo "status=${SUCCESS}" >> "$GITHUB_OUTPUT" - exit ${SUCCESS} - shell: bash diff --git a/.github/scripts/build b/.github/scripts/build index 4af54980d009b..6b3b51f6594a4 100755 --- a/.github/scripts/build +++ b/.github/scripts/build @@ -6,7 +6,6 @@ usage() { echo echo "usage: ${0} " echo - echo " -a - pypi server address" echo " -p - python version" echo " -v - name for virtualenv" echo " -h - this list of options" @@ -17,15 +16,12 @@ PYPI_IP= PYTHON= VENV= -while getopts "ha:p:v:" OPT; do +while getopts "hp:v:" OPT; do case "${OPT}" in h) usage exit 1 ;; - a) - PYPI_IP="${OPTARG}" - ;; p) PYTHON="${OPTARG}" ;; @@ -36,12 +32,6 @@ while getopts "ha:p:v:" OPT; do done # check if variables are valid -if [ -z "${PYPI_IP}" ]; then - echo "please provide 'pypi' server address" - usage - exit 1 -fi - if [ -z "${PYTHON}" ]; then echo "please provide python version, e.g. 3.10.12" usage @@ -55,6 +45,5 @@ if [ -z "${VENV}" ]; then fi source $(pyenv root)/versions/${PYTHON}/envs/${VENV}/bin/activate -pip3 install --index-url http://${PYPI_IP}:8080/ --trusted-host ${PYPI_IP} nm-magic-wand-nightly pip3 install -r requirements-cuda.txt -r requirements-build.txt pip3 install -e . diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 2100261c0e48a..539f8af3740df 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -116,6 +116,7 @@ jobs: BUILD: uses: ./.github/workflows/build.yml with: + wf_category: ${{ inputs.wf_category }} build_label: ${{ inputs.build_label }} timeout: ${{ inputs.build_timeout }} gitref: ${{ github.ref }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c2b2f3fa8727..12928b9fab1f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,10 @@ on: # makes workflow reusable workflow_call: inputs: + wf_category: + description: "categories: REMOTE, NIGHTLY, RELEASE" + type: string + default: "REMOTE" build_label: description: "requested runner label (specifies instance)" type: string @@ -31,6 +35,10 @@ on: # makes workflow manually callable workflow_dispatch: inputs: + wf_category: + description: "categories: REMOTE, NIGHTLY, RELEASE" + type: string + default: "REMOTE" build_label: description: "requested runner label (specifies instance)" type: string @@ -83,6 +91,7 @@ jobs: id: setenv uses: ./.github/actions/nm-set-env/ with: + wf_category: ${{ inputs.wf_category }} hf_token: ${{ secrets.NM_HF_TOKEN }} Gi_per_thread: ${{ inputs.Gi_per_thread }} nvcc_threads: ${{ inputs.nvcc_threads }} diff --git a/.github/workflows/gen-whl.yml b/.github/workflows/gen-whl.yml deleted file mode 100644 index 3bf9fb7a5296f..0000000000000 --- a/.github/workflows/gen-whl.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: generate whl -run-name: ${{ github.actor }} generating whl on branch '${{ github.ref }}' -on: - workflow_dispatch: - inputs: - gitref: - description: 'git commit hash or branch name' - type: string - required: true - -jobs: - - GCP-K8S-BUILD: - strategy: - matrix: - python: [3.8.17, 3.9.17, 3.10.12, 3.11.4] - uses: ./.github/workflows/build.yml - with: - build_label: gcp-k8s-build - timeout: 60 - gitref: ${{ inputs.gitref }} - Gi_per_thread: 4 - nvcc_threads: 8 - python: ${{ matrix.python }} - secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3daeb90301237..b9692111474b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,43 @@ concurrency: jobs: - BUILD-TEST: + PYTHON-3-8: + uses: ./.github/workflows/build-test.yml + with: + wf_category: 'RELEASE' + python: 3.8.17 + gitref: ${{ github.ref }} + + test_label_solo: aws-avx2-32G-a10g-24G + test_label_multi: aws-avx2-192G-4-a10g-96G + test_timeout: 480 + test_skip_list: neuralmagic/tests/skip-for-release.txt + + benchmark_label: aws-avx2-32G-a10g-24G + benchmark_config_list_file: ./.github/data/nm_benchmark_nightly_configs_list.txt + benchmark_timeout: 180 + push_benchmark_results_to_gh_pages: ${{ inputs.push_benchmark_results_to_gh_pages }} + secrets: inherit + + PYTHON-3-9: + uses: ./.github/workflows/build-test.yml + with: + wf_category: 'RELEASE' + python: 3.9.17 + gitref: ${{ github.ref }} + + test_label_solo: aws-avx2-32G-a10g-24G + test_label_multi: aws-avx2-192G-4-a10g-96G + test_timeout: 480 + test_skip_list: neuralmagic/tests/skip-for-release.txt + + benchmark_label: aws-avx2-32G-a10g-24G + benchmark_config_list_file: ./.github/data/nm_benchmark_nightly_configs_list.txt + benchmark_timeout: 180 + push_benchmark_results_to_gh_pages: ${{ inputs.push_benchmark_results_to_gh_pages }} + secrets: inherit + + PYTHON-3-10: uses: ./.github/workflows/build-test.yml with: wf_category: 'RELEASE' @@ -34,3 +70,21 @@ jobs: benchmark_timeout: 180 push_benchmark_results_to_gh_pages: ${{ inputs.push_benchmark_results_to_gh_pages }} secrets: inherit + + PYTHON-3-11: + uses: ./.github/workflows/build-test.yml + with: + wf_category: 'RELEASE' + python: 3.11.4 + gitref: ${{ github.ref }} + + test_label_solo: aws-avx2-32G-a10g-24G + test_label_multi: aws-avx2-192G-4-a10g-96G + test_timeout: 480 + test_skip_list: neuralmagic/tests/skip-for-release.txt + + benchmark_label: aws-avx2-32G-a10g-24G + benchmark_config_list_file: ./.github/data/nm_benchmark_nightly_configs_list.txt + benchmark_timeout: 180 + push_benchmark_results_to_gh_pages: ${{ inputs.push_benchmark_results_to_gh_pages }} + secrets: inherit diff --git a/setup.py b/setup.py index c67c7f8760630..7f87ee806057e 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ # UPSTREAM SYNC: noqa is required for passing ruff. # This file has been modified by Neural Magic +import datetime import importlib.util import io import logging @@ -306,9 +307,28 @@ def find_version(filepath: str) -> str: raise RuntimeError("Unable to find version string.") +# Neuralmagic packaging ENV's +NM_RELEASE_TYPE = 'NM_RELEASE_TYPE' + + +def get_nm_vllm_package_name() -> str: + nm_release_type = os.getenv(NM_RELEASE_TYPE) + package_name = None + if nm_release_type == 'RELEASE': + package_name = 'nm-vllm' + else: + package_name = 'nm-vllm-nightly' + return package_name + + def get_vllm_version() -> str: version = find_version(get_path("vllm", "__init__.py")) + nm_release_type = os.getenv(NM_RELEASE_TYPE) + if nm_release_type != 'RELEASE': + date = datetime.date.today().strftime("%Y%m%d") + version += f'.{date}' + if _is_cuda(): cuda_version = str(get_nvcc_cuda_version()) if cuda_version != MAIN_CUDA_VERSION: @@ -393,6 +413,9 @@ def _read_requirements(filename: str) -> List[str]: # UPSTREAM SYNC: needed for sparsity _sparsity_deps = ["nm-magic-wand-nightly"] +nm_release_type = os.getenv(NM_RELEASE_TYPE) +if nm_release_type == 'RELEASE': + _sparsity_deps = ["nm-magic-wand"] package_data = { "vllm": ["py.typed", "model_executor/layers/fused_moe/configs/*.json"] @@ -402,7 +425,7 @@ def _read_requirements(filename: str) -> List[str]: package_data["vllm"].append("*.so") setup( - name="nm-vllm", + name=get_nm_vllm_package_name(), version=get_vllm_version(), author="vLLM Team, Neural Magic", author_email="support@neuralmagic.com",