#NPU
ChengsenWang/ChatTime-1-7B-Chat (HuggingFace)20baa88d6ab838b34abbd1d2b1f4cea57c8ff870 (main)LlamaForCausalLM - 32 layers, hidden_size 4096, intermediate 11008, 32 heads, vocab 42001 (32000 base + 10002 time-series tokens + special), max_position 4096, torch_dtype bfloat16, Apache-2.0ChengsenWang/ChatTime-1-7B-Base on ChengsenWang/ChatTime-1-Finetune-100Khist_len=120 -> pred_len=24) with synthetic Traffic-like series.forecasting (univariate, continuous)hist_data np.ndarray shape (120,) dtype float32, values ~35..65 (synthetic sine: sin(2πt/30)+0.5cos(2πt/50)+noise)*10+50, seed 42)Discretizer (sklearn MinMaxScaler fit on hist[:hist_len], low_limit=-1, high_limit=1, n_tokens=10002): fit scaler on hist, transform to [-0.5,0.5], digitize to 10001 bins, map to centers (10002 values)Serializer (prec=4, time_flag=###): ###value#### joined by spacegetPrompt(flag=prediction): PRE_SYS_PROMPT + PRE_INST_PROMPT + serialized_input in TEMPLATE System\n\n### Instruction:\n...\n\n### Input:\n...\n\n### Response:\nLlamaTokenizer vocab 42001, pad=eos, right padding, add_bos truemax_new_tokens=56 (2*pred_len+8), do_sample=False (greedy for deterministic validation; original paper uses do_sample True, num_samples 8, top_k 100, temperature 1.0, median)inverse_serialize regex ###(.*?)###, inverse_discretize via scaler inverseprediction np.ndarray shape (24,) float32, de-normalized to original scale, finite, no NaN after pad./dataset/Traffic.csv with Hist column but synthetic demonstrates pipeline.torch_npu 2.9.0.post1+gitee7ba04torch 2.9.0+cpu, transformers 4.57.6, numpy 1.26.4, scikit-learn 1.7.0, huggingface_hub 0.33.1HF_ENDPOINT=https://hf-mirror.comnpu:0 explicit, torch.npu.is_available()==True, torch.npu.device_count()>=1Collect via:
npu-smi info
python .opencode/skills/npu-adapt-skills/scripts/check_npu.py
python .opencode/skills/npu-adapt-skills/scripts/collect_env.py --output working/env.jsonpip install -r requirements.txt
# requirements: torch, torch_npu, transformers, numpy, scikit-learn, huggingface_hub, accelerate, sentencepieceWeights must be present at working/models/ChatTime-1-7B-Chat (13.6 GB). If missing, inference.py will download via snapshot_download respecting HF_ENDPOINT.
hf download ChengsenWang/ChatTime-1-7B-Chat --local-dir working/models/ChatTime-1-7B-Chatpython submission/inference.py
# default: npu:0, hist_len 120, pred_len 24, greedy, bfloat16, sync timingWhat it does:
LlamaForCausalLM bfloat16 from local dir, model.to('npu:0') (prints param device before/after)input_ids on npu:0torch.npu.synchronize() before/after each generate, warmup compile + timed run + benchmark 5 runsExpected stdout excerpt (NPU):
[INFO] model_name: ChengsenWang/ChatTime-1-7B-Chat
[INFO] device: npu:0
[INFO] npu_available: True
[INFO] npu_device_name: Ascend910_9362
[INFO] first param device after to(npu:0): npu:0
[INFO] hist_data shape: (120,) mean 50.1927
[INFO] input_ids shape: (1, 293) device npu:0
[INFO] warmup/compile time: 2049.36 ms
[INFO] NPU inference time (single, sync): 1713.70 ms
[INFO] generated token ids len 56 preview [36703, 29871, 36951, ...]
[INFO] prediction shape: (24,) preview [48.181..., 49.636..., 50.205...]
[SUCCESS] ChatTime NPU forecasting completedmax_abs_error 2.03, mean_abs_error 1.92 (atol 5, rtol 0.1 PASS) – bfloat16 greedy neighboring token divergence (36701 vs 36703) expected for 7B LLM; forecast stays within 4% of value range.python working/run_chattime_cpu.py # saves working/cpu_chattime.npy (486s)
python working/run_chattime_npu.py # saves working/npu_chattime.npy (1.7s)
python .opencode/skills/npu-adapt-skills/scripts/compare_outputs.py --cpu working/cpu_chattime.npy --npu working/npu_chattime.npy --task forecasting --atol 5 --rtol 0.1
# {"passed": true, "max_abs_error":2.03, "mean_abs_error":1.92}first param device npu:0 verified, input NPU device npu:0)npu:0, bfloat16, batch 1, context 120+293 prompt tokens, max_new 56
Benchmark: torch.npu.synchronize() before/after each iteration, 2 warmups, 5 measured runs.
All three PNGs generated from real logs via xterm.js (raw style, prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$, dark #282828, white mono). README only references images, does not disclose renderer internals beyond mention.


python submission/inference.py full output): 
Images are xterm.js renderings of actual terminal logs from this NPU pod, not simulated drawings. Source logs under
working/logs/and manifestworking/evidence.json.
fit() required; inference-only adaptation. Training not moved to NPU../dataset/.