w
gcw_uQ09W7jl/OpenAlphaDiffract-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

linked-liszt/OpenAlphaDiffract on Ascend NPU

模型与任务

  • 模型:linked-liszt/OpenAlphaDiffract
  • Revision:9109b0f2f205038a024de0b7382fd02a7ddb97b1
  • 适配路线:diffraction-pattern
  • 设备:npu:0

环境依赖

{
  "torch": "2.9.0+cpu",
  "torch_npu_available": true,
  "device_name": "Ascend910_9362",
  "device_count": 2,
  "torch_npu": "2.9.0.post1+gitee7ba04"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "batch_size": 2,
  "input_length": 8192,
  "input_shape": [
    2,
    8192
  ],
  "expanded_shape": [
    2,
    1,
    8192
  ],
  "two_theta_range": "5-20deg",
  "preprocessing": "floor_at_zero + normalize [0,100]",
  "dtype": "torch.float32",
  "seed": 42,
  "sha256": "a1b076d17c5d9747",
  "spectra": 2,
  "points_per_spectrum": 8192,
  "normalization": "[0,100]"
}

真实推理结果

{
  "output_shapes": {
    "cs_logits": [
      2,
      7
    ],
    "sg_logits": [
      2,
      230
    ],
    "lp": [
      2,
      6
    ]
  },
  "dtypes": {
    "cs_logits": "float32",
    "sg_logits": "float32",
    "lp": "float32"
  },
  "cs_probs_sample0": [
    0.0025355194229632616,
    0.9120612740516663,
    0.08313798159360886,
    7.421187910949811e-05,
    0.0021880336571484804,
    2.9855721095373156e-06,
    1.609574626360022e-11
  ],
  "cs_pred_sample0": "Monoclinic",
  "sg_pred_sample0": 74,
  "sg_top3_sample0": [
    73,
    43,
    11
  ],
  "lp_sample0": [
    6.205404758453369,
    8.313213348388672,
    13.1318998336792,
    91.29310607910156,
    90.34532165527344,
    90.68952178955078
  ],
  "lp_bounds_ok": true,
  "device_proof": "first_param:npu:0, output_cs:npu:0, input:npu:0, gemd:npu:0",
  "finite": true
}

CPU-NPU 一致性

{
  "cs_logits": {
    "passed": true,
    "max_abs_diff": 0.02099609375,
    "mean_abs_diff": 0.005269629614693778,
    "rmse": 0.007660969731510844,
    "argmax_agree": true,
    "shape": [
      2,
      7
    ],
    "elements": 14
  },
  "sg_logits": {
    "passed": true,
    "max_abs_diff": 0.0353240966796875,
    "mean_abs_diff": 0.011453943667204484,
    "rmse": 0.013571200640235544,
    "argmax_agree": true,
    "shape": [
      2,
      230
    ],
    "elements": 460
  },
  "lp": {
    "passed": true,
    "max_abs_diff": 0.004401206970214844,
    "mean_abs_diff": 0.0012262264887491863,
    "rmse": 0.001799141083904231,
    "mae_per_param": [
      0.0005443096160888672,
      0.0005326271057128906,
      0.0027937889099121094,
      0.001163482666015625,
      0.000644683837890625,
      0.001678466796875
    ],
    "shape": [
      2,
      6
    ],
    "elements": 12
  },
  "overall_passed": true,
  "lp_bounds_ok": true
}

性能

{
  "first_run_ms": 190.93561172485352,
  "second_run_ms": 1.6431808471679688,
  "avg_ms": 1.377415657043457,
  "min_ms": 1.3468265533447266,
  "max_ms": 1.447439193725586,
  "p50_ms": 1.36566162109375,
  "p90_ms": 1.4324188232421875,
  "throughput_spectra_per_s": 1451.99453031693,
  "throughput_points_per_s": 11894739.19235629,
  "batch_size": 2,
  "input_length": 8192,
  "dtype": "float32"
}

自验证截图

Agent workflow

NPU device call

Model result

已知限制

  • 仅对本次记录的模型 revision、输入契约、dtype 与 Ascend 环境完成验证。
  • 合成 PXRD 峰型输入,非实验 RRUFF;真实实验数据需相同归一化。
  • 单卡 Ascend910 单精度 float32 验证。

标签

#NPU #Ascend #Ascend910