Merged
fix: replace leftover torchao_npu references in benchmarks with torchao_ascend #191
pengpeng7872Add on 2 days ago
fix: replace leftover torchao_npu references in benchmarks with torchao_ascend #191
Merged
Total: 6 files changed+7-7
| @@ -19,8 +19,8 @@ from pathlib import Path | |||
| 19 | import torch | 19 | import torch |
| 20 | 20 | ||
| 21 | from torchao.prototype.moe_training.utils import generate_jagged_offs | 21 | from torchao.prototype.moe_training.utils import generate_jagged_offs |
| 22 | -from torchao_npu.features.training.hifloat8.config import HiFloat8GMMConfig | 22 | +from torchao_ascend.features.training.hifloat8.config import HiFloat8GMMConfig |
| 23 | -from torchao_npu.features.training.hifloat8.hifloat8_gmm import hifloat8_gmm | 23 | +from torchao_ascend.features.training.hifloat8.hifloat8_gmm import hifloat8_gmm |
| 24 | 24 | ||
| 25 | from timer import bench_fwd_bwd_us, bench_fwd_us | 25 | from timer import bench_fwd_bwd_us, bench_fwd_us |
| 26 | from utils import ( | 26 | from utils import ( |
| @@ -20,7 +20,7 @@ import torch.nn as nn | |||
| 20 | import torch.nn.functional as F | 20 | import torch.nn.functional as F |
| 21 | 21 | ||
| 22 | from torchao.quantization import quantize_ | 22 | from torchao.quantization import quantize_ |
| 23 | -from torchao_npu.features.training.hifloat8.hifloat8_inference import ( | 23 | +from torchao_ascend.features.training.hifloat8.hifloat8_inference import ( |
| 24 | HiFloat8DynamicActivationHiFloat8WeightConfig, | 24 | HiFloat8DynamicActivationHiFloat8WeightConfig, |
| 25 | ) | 25 | ) |
| 26 | 26 | ||
| @@ -22,7 +22,7 @@ import torch.nn as nn | |||
| 22 | import torch.nn.functional as F | 22 | import torch.nn.functional as F |
| 23 | 23 | ||
| 24 | from torchao.quantization import quantize_ | 24 | from torchao.quantization import quantize_ |
| 25 | -from torchao_npu.features.training.hifloat8.config import HiFloat8LinearConfig | 25 | +from torchao_ascend.features.training.hifloat8.config import HiFloat8LinearConfig |
| 26 | 26 | ||
| 27 | from timer import bench_fwd_bwd_us, bench_fwd_us | 27 | from timer import bench_fwd_bwd_us, bench_fwd_us |
| 28 | from utils import ( | 28 | from utils import ( |
| @@ -19,7 +19,7 @@ from pathlib import Path | |||
| 19 | from typing import Callable, Optional | 19 | from typing import Callable, Optional |
| 20 | 20 | ||
| 21 | import torch | 21 | import torch |
| 22 | -import torchao_npu # noqa: F401 activates MXFP8/HiFloat8 patches + injects KernelPreference.NPU | 22 | +import torchao_ascend # noqa: F401 activates MXFP8/HiFloat8 patches + injects KernelPreference.NPU |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | # --------------------------------------------------------------------------- | 25 | # --------------------------------------------------------------------------- |
| @@ -24,7 +24,7 @@ torchao PTQ recipe 的 **lm_eval 精度**:进程内量化或从落盘 ckpt 直 | |||
| 24 | - **会话环境变量**(脚本不内置,按需在运行前 export): | 24 | - **会话环境变量**(脚本不内置,按需在运行前 export): |
| 25 | - `PYTHONPATH=<仓根>` —— torchao_ascend 未 pip 安装(源码仓直用)时必须; | 25 | - `PYTHONPATH=<仓根>` —— torchao_ascend 未 pip 安装(源码仓直用)时必须; |
| 26 | - `HF_ENDPOINT=https://hf-mirror.com` —— HF Hub 不通时用(lm_eval 任务数据**首次**运行在线下载);之后缓存于 `~/.cache/huggingface`,加 `HF_HUB_OFFLINE=1` 可完全离线运行; | 26 | - `HF_ENDPOINT=https://hf-mirror.com` —— HF Hub 不通时用(lm_eval 任务数据**首次**运行在线下载);之后缓存于 `~/.cache/huggingface`,加 `HF_HUB_OFFLINE=1` 可完全离线运行; |
| 27 | - - `TORCH_DEVICE_BACKEND_AUTOLOAD=0` —— torch import 报 `Failed to load the backend extension: torchao_npu` 时(旧 editable 安装残留触发); | 27 | + - `TORCH_DEVICE_BACKEND_AUTOLOAD=0` —— torch import 报 `Failed to load the backend extension: torchao_ascend` 时(旧 editable 安装残留触发); |
| 28 | - CANN:非交互 shell(如 ssh 直跑)需先 `source <cann路径>/set_env.sh`(`.bashrc` 不会加载)。 | 28 | - CANN:非交互 shell(如 ssh 直跑)需先 `source <cann路径>/set_env.sh`(`.bashrc` 不会加载)。 |
| 29 | 29 | ||
| 30 | ## 用法(仓根目录) | 30 | ## 用法(仓根目录) |
| @@ -31,7 +31,7 @@ | |||
| 31 | # | 31 | # |
| 32 | # Session env (NOT set here; see README 环境要求): HF_ENDPOINT for an HF mirror | 32 | # Session env (NOT set here; see README 环境要求): HF_ENDPOINT for an HF mirror |
| 33 | # when the Hub is unreachable, and TORCH_DEVICE_BACKEND_AUTOLOAD=0 when an old | 33 | # when the Hub is unreachable, and TORCH_DEVICE_BACKEND_AUTOLOAD=0 when an old |
| 34 | -# torchao_npu editable install triggers a backend-autoload error. | 34 | +# torchao_ascend editable install triggers a backend-autoload error. |
| 35 | 35 | ||
| 36 | set -e | 36 | set -e |
| 37 | cd "$(dirname "$0")/../.." # repo root, so relative output dirs land right | 37 | cd "$(dirname "$0")/../.." # repo root, so relative output dirs land right |