eardoi/mitra-classifier-1.1-npu
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Mitra Classifier 1.1 - 昇腾 NPU 适配模型

Mitra 是 autogluon 的表格数据基础模型(1.1 版本),基于 Tab2D 架构 (in-context learning),支持零样本表格分类。本仓库为 华为昇腾 NPU (Ascend 910B 系列)推理适配版,支持 npu:0 一键推理。

模型简介

项目说明
模型autogluon/mitra-classifier-1.1
架构Tab2D(表格数据 Transformer 基础模型)
规模75.7 M 参数(FP32)
输入x_support (b,16,8) + y_support (b,16) + x_query (b,8,8)
输出预测 logits (b, 8, 10)
任务表格数据分类(零样本 ICL)
原始仓库autogluon/autogluon
LicenseApache-2.0

环境要求

项目要求
硬件Ascend 910B 系列(≥1 卡,本仓库基于 910B4 验证)
CANN≥ 8.0
Python3.10 – 3.11
torch / torch_npu2.9.0 / 2.9.0.post2
依赖库einops、einx、safetensors + autogluon 源码(mitra/_internal/models/tab2d.py)

模型权重

注意:本仓库不包含模型权重文件(model.safetensors 约 0.28GB)。

权重请从以下镜像获取:

git clone --depth 1 https://gitcode.com/hf_mirrors/autogluon/mitra-classifier-1.1.git model_src

推理

用法

python3 inference.py --device npu [--model_path ./model_src]
python3 inference.py --device cpu

实测输出(昇腾 910B4)

$ python3 inference.py --device npu
[info] device = npu:0
[info] model arch     : Tab2D (Mitra 表格基础模型)
      参数: 75.7 M
[info] input          : support 16x8 + query 8x8
[info] 模型前向 forward (device=npu) ...
[info] inference done : 805.3 ms on npu
[info] 预测输出       : (1, 8, 10) (b x n_q x n_classes)
[info] 设备确认       : npu:0
[PASS] mitra-classifier-1.1 NPU inference OK

验证结果

指标结果
推理设备npu:0 (Ascend910B4)
参数量75.7 M (FP32)
输入support 16×8 + query 8×8
输出预测 logits (1, 8, 10)
推理耗时805.3 ms
状态[PASS] NPU inference OK

适配说明

  • 模型为 autogluon Mitra 自定义架构(Tab2D,从 AtomGit gh_mirrors/au/autogluon 镜像获取源码),无 CUDA 特有 API。
  • 加载方式:直接用 Tab2D.from_pretrained(本地目录)加载,绕过 autogluon 框架依赖链(其 mitra 包 __init__.py 为空,可独立导入)。
  • NPU 适配点:加载后需显式 .to('npu:0') 迁移全部参数。
  • 加载使用 local_files_only=True 完全离线。