From 8fb203b278657e2b8ff286a5aa25688c98d8b818 Mon Sep 17 00:00:00 2001 From: weizhan4 Date: Tue, 19 Aug 2025 11:33:21 +0800 Subject: [PATCH] AOTI download miniz.h --- SECURITYNOTE.md | 3 +-- build_libtorch_npu.py | 17 ++--------------- setup.py | 17 ++--------------- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/SECURITYNOTE.md b/SECURITYNOTE.md index 27ca0b46ef..1e52dc4614 100644 --- a/SECURITYNOTE.md +++ b/SECURITYNOTE.md @@ -98,8 +98,7 @@ torch_npu支持源码编译安装,在编译时会下载依赖第三方库并 | 自研 | 不涉及 | test\requirements.txt | https://data.pyg.org/whl/torch-2.6.0+cpu.html | 下载链接,用于下载torch-scatter的cpu版本 | | 自研 | 不涉及 | requirements.txt | https://download.pytorch.org/whl/cpu | 下载链接,用于下载torch-cpu版本 | | 自研 | 不涉及 | test\get_synchronized_files.sh | https://github.com/pytorch/pytorch.git | 下载链接,用于下载pytorch的测试用例 | - -| 开源引入 | https://github.com/richgel999/miniz/blob/3.0.2/miniz.h | build_libtorch_npu.py | https://github.com/richgel999/miniz/releases/download/3.0.2/miniz-3.0.2.zip | 下载链接,用于下载miniz库,miniz用于AOTInductor压缩和解压缩pt2模型文件 | +| 开源引入 | https://gitee.com/mirrors/pytorch/blob/v2.6.0/third_party/miniz-3.0.2/miniz.h | build_libtorch_npu.py
setup.py | https://gitee.com/mirrors/pytorch/raw/v2.6.0/third_party/miniz-3.0.2/miniz.h | 下载链接,用于下载miniz库 | ## 公开接口声明 Ascend Extension for PyTorch是PyTorch适配插件,支持用户使用PyTorch在昇腾设备上进行训练和推理。Ascend Extension for PyTorch适配后支持用户使用PyTorch原生接口。除了原生PyTorch接口外,Ascend Extension for PyTorch提供了部分自定义接口,包括自定义算子、亲和库和其他接口,支持PyTorch接口和自定义接口连接,具体可参考[《PyTorch API参考》](https://www.hiascend.com/document/detail/zh/Pytorch/60RC2/apiref/apilist/ptaoplist_000001.html)。 diff --git a/build_libtorch_npu.py b/build_libtorch_npu.py index 22ad8303bc..ec3d29a500 100644 --- a/build_libtorch_npu.py +++ b/build_libtorch_npu.py @@ -269,7 +269,7 @@ def copy_cmake(): def download_miniz(): # 设置基础路径 - miniz_url = "https://github.com/richgel999/miniz/releases/download/3.0.2/miniz-3.0.2.zip" + miniz_url = "https://gitee.com/mirrors/pytorch/raw/v2.6.0/third_party/miniz-3.0.2/miniz.h" miniz_dir = os.path.join(BASE_DIR, "third_party/miniz-3.0.2") if os.path.exists(miniz_dir): # 检查目录是否存在 @@ -281,30 +281,17 @@ def download_miniz(): raise RuntimeError(f"clean {miniz_dir} failed") from e os.makedirs(miniz_dir, exist_ok=True) # 重建空目录 - zip_path = os.path.join(miniz_dir, "miniz.zip") # 获取wget绝对路径 wget_path = shutil.which("wget") if not wget_path: raise RuntimeError("wget not found, please install wget") - - # 获取unzip绝对路径 - unzip_path = shutil.which("unzip") - if not unzip_path: - raise RuntimeError("unzip not found, please install unzip") # 使用绝对路径下载文件 subprocess.check_call([ wget_path, miniz_url, - "-O", zip_path - ]) - - # 使用绝对路径解压文件 - subprocess.check_call([ - unzip_path, - zip_path, - "-d", miniz_dir + "-O", os.path.join(miniz_dir, "miniz.h") ]) diff --git a/setup.py b/setup.py index d9bdf5fdf3..639b6fa3c5 100644 --- a/setup.py +++ b/setup.py @@ -106,7 +106,7 @@ def check_submodules(): def download_miniz(): # 设置基础路径 - miniz_url = "https://github.com/richgel999/miniz/releases/download/3.0.2/miniz-3.0.2.zip" + miniz_url = "https://gitee.com/mirrors/pytorch/raw/v2.6.0/third_party/miniz-3.0.2/miniz.h" miniz_dir = os.path.join(BASE_DIR, "third_party/miniz-3.0.2") if os.path.exists(miniz_dir): # 检查目录是否存在 @@ -118,30 +118,17 @@ def download_miniz(): raise RuntimeError(f"clean {miniz_dir} failed") from e os.makedirs(miniz_dir, exist_ok=True) # 重建空目录 - zip_path = os.path.join(miniz_dir, "miniz.zip") # 获取wget绝对路径 wget_path = shutil.which("wget") if not wget_path: raise RuntimeError("wget not found, please install wget") - - # 获取unzip绝对路径 - unzip_path = shutil.which("unzip") - if not unzip_path: - raise RuntimeError("unzip not found, please install unzip") # 使用绝对路径下载文件 subprocess.check_call([ wget_path, miniz_url, - "-O", zip_path - ]) - - # 使用绝对路径解压文件 - subprocess.check_call([ - unzip_path, - zip_path, - "-d", miniz_dir + "-O", os.path.join(miniz_dir, "miniz.h") ]) -- Gitee