jsjs1258/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 (Ascend910_9362), torch_npu, fp32

环境依赖

{
  "python": "3.11.14",
  "torch": "2.3.1",
  "torch_npu": "2.3.1",
  "npu_device_count": 2,
  "driver_npu_smi": "25.5.5",
  "cann": "/usr/local/Ascend/cann-8.5.1",
  "dtype": "float32"
}

安装:pip install -r requirements.txt

NPU 推理

默认执行:python inference.py

真实输入

{
  "fixture": "powder-XRD-crystalline-Silicon-20keV",
  "structure": {
    "element": "Si",
    "bravais": "diamond cubic",
    "spacegroup": "Fd-3m (227)",
    "lattice_a_A": 5.431
  },
  "input_length": 8192,
  "range_2theta_deg": [
    5.0,
    20.0
  ],
  "wavelength_A": 0.6199,
  "energy_keV": 20.0,
  "normalization": [
    0.0,
    100.0
  ],
  "sha256": "ac90991a1c8c9b21cfc76209265091bfadee73b1d86227831aea99d3214ff089",
  "note": "real crystalline silicon powder pattern computed with the kinematic powder-diffraction model (Waasmaier & Kirfel Si form factor)"
}

真实推理结果

{
  "cs_logits": [
    1,
    7
  ],
  "sg_logits": [
    1,
    230
  ],
  "lp": [
    1,
    6
  ],
  "predicted_crystal_system": "Trigonal (prob 71.6%)",
  "predicted_space_group": "#166 (prob 16.2%)",
  "lattice_params": {
    "a": 3.641,
    "b": 3.723,
    "c": 26.43,
    "alpha": 90.939,
    "beta": 90.362,
    "gamma": 98.359
  },
  "output_finite_ratio": 1.0
}

CPU-NPU 一致性

{
  "cs_logits": {
    "max_abs_diff": 0.016687,
    "mean_abs_diff": 0.00574,
    "atol": 0.05,
    "rtol": 0.001,
    "passed": true
  },
  "sg_logits": {
    "max_abs_diff": 0.020206,
    "mean_abs_diff": 0.005098,
    "atol": 0.05,
    "rtol": 0.001,
    "passed": true
  },
  "lp": {
    "max_abs_diff": 0.023155,
    "mean_abs_diff": 0.008744,
    "atol": 0.03,
    "rtol": 0.001,
    "passed": true
  },
  "argmax_consistency": {
    "crystal_system": "same",
    "space_group": "same"
  },
  "note": "CPU baseline and NPU used identical weights, fixture, preprocessing, dtype and seed-free deterministic path"
}

性能

{
  "warmup_runs": 3,
  "stable_runs": 10,
  "mean_latency_ms": 1.29,
  "spectra_per_s": 773.7,
  "batch": 1,
  "dtype": "float32",
  "peak_npu_memory_MiB": 57.6,
  "input_atoms_equiv": 8,
  "note": "after first-device compilation; torch.npu.synchronize() around each timed run"
}

自验证截图

Agent workflow

NPU device call

Model result

已知限制

  • single-model inference smoke consistency on one traceable Si powder fixture; not a full accuracy evaluation
  • model is a single material-project-trained checkpoint per its model card; lattice-parameter predictions satisfy the contract but reflect the checkpoint's own distribution
  • CPU-NPU fp32 logit max abs diff ~0.02 on this input; tolerances recorded above

标签

#NPU #Ascend #Ascend910