Commit 489b7626 authored by zhangzbb's avatar zhangzbb
Browse files

[Tencent FIX BUILD FLOW] stabilize Hygon DCU wheel build and install flow

parent 60c98e29
......@@ -83,7 +83,7 @@ VLLM_USE_HYGON=1 python3 setup.py install (若调试,可使用 VLLM_USE_HYGO
> 注意:
> - 海光 DCU 环境必须设置 `VLLM_USE_HYGON=1`。
> - 构建时会自动将海光定制包(如 `torch`、`triton`、`flash_attn`)改写为当前环境中的精确 `+das.*` 版本,避免 pip 在安装时替换为不兼容的 PyPI 版本。
> - `hygon.txt` 只对高风险包做最小锁定:`numpy==1.26.4` 以及海光定制包,其余 Python 依赖保持正常解析。
> - `hygon.txt` 只对高风险包做最小锁定:`numpy==1.26.4` 以及海光定制包的基础版本,其余 Python 依赖保持正常
> - 海光路径会将 `fastapi[standard]`、`mistral_common[image]` 这类容易触发深度回溯的 extras 依赖替换为镜像中已验证的显式依赖版本。
> - 可使用 `python tools/check_hygon_env.py` 在构建前和安装后校验关键包版本
......
......@@ -3,8 +3,7 @@
#
# Keep the lock set minimal:
# - pin numpy explicitly to avoid ABI-breaking upgrades
# - keep Hygon custom packages on base versions here, then rewrite them
# to exact +das.* installed versions during bdist_wheel
# - keep Hygon custom packages on base versions here
-r common.txt
# Pin numpy to 1.26.x: compatible with both custom torch ABI and
......
......@@ -1046,29 +1046,11 @@ def get_vllm_version() -> str:
return version
def _pin_hygon_local_versions(requirements: list[str]) -> list[str]:
"""Pin packages with +das.* local versions to their exact installed
versions, and deduplicate requirements (later entries win)."""
import importlib.metadata
# First pass: pin +das versions
pinned = []
for req in requirements:
match = re.match(r'^([a-zA-Z0-9_-]+)\s*==', req)
if match:
pkg_name = match.group(1)
try:
installed_ver = importlib.metadata.version(pkg_name)
if "+das" in installed_ver:
pinned.append(f"{pkg_name} == {installed_ver}")
continue
except importlib.metadata.PackageNotFoundError:
pass
pinned.append(req)
def _dedupe_requirements(requirements: list[str]) -> list[str]:
"""Deduplicate requirements by package name, keeping later entries."""
# Second pass: deduplicate by package name (later entries win)
seen = {}
for req in pinned:
for req in requirements:
match = re.match(r'^([a-zA-Z0-9_-]+)', req)
if match:
pkg_name = match.group(1).lower().replace("-", "_")
......@@ -1195,7 +1177,7 @@ def get_requirements() -> list[str]:
_validate_hygon_build_env()
requirements = _read_requirements("hygon.txt")
requirements = _rewrite_hygon_requirements(requirements)
requirements = _pin_hygon_local_versions(requirements)
requirements = _dedupe_requirements(requirements)
else:
requirements = _read_requirements("rocm.txt")
elif _is_tpu():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment