Phips commited on
Commit
ac25f3a
·
verified ·
1 Parent(s): 868878c

add HEART vs HAT_M speed benchmark (PyTorch/ONNX/TensorRT)

Browse files
Files changed (1) hide show
  1. README.md +43 -0
README.md CHANGED
@@ -304,3 +304,46 @@ HEART is a re-implementation/simplification inspired by:
304
 
305
  The architecture file is original code; verify attribution/compatibility
306
  against those papers before commercial redistribution.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
 
305
  The architecture file is original code; verify attribution/compatibility
306
  against those papers before commercial redistribution.
307
+
308
+ ## Update — 2026-09-30: speed benchmark (HEART vs HAT_M)
309
+
310
+ Measured on an **RTX 3060**, input `1x3x256x256` (a typical SR tile), fp16,
311
+ warmup 5, mean of 20 runs. ONNX is static-shape; TensorRT uses the same builder
312
+ options as NERVE's published config (`builderOptimizationLevel=5` + CUDA graphs).
313
+
314
+ | model | params | PyTorch fp16 | ONNX fp16 | **TensorRT fp16** | peak VRAM |
315
+ |---|---|---|---|---|---|
316
+ | **HEART 4x** | 16.7M | 816 ms | 745 ms | **266 ms** (208 FPS) | **679 MB** |
317
+ | HEART 4x OTF GAN | 16.7M | 809 ms | 753 ms | **270 ms** | 679 MB |
318
+ | HAT_M 4x | 20.8M | 1485 ms | 849 ms | 598 ms (107 FPS) | 2428 MB |
319
+
320
+ **Verdict.** At a 256px tile HEART is **~1.8x faster than HAT_M** in PyTorch and
321
+ uses **~3.6x less VRAM** (679 MB vs 2.4 GB) — a bigger margin than our earlier
322
+ 30k-iteration note suggested. Under **TensorRT** both get dramatically faster,
323
+ and HEART keeps a **~2.2x** lead (266 ms vs 598 ms).
324
+
325
+ **TensorRT is a big win for HEART** (3.1x over PyTorch), much larger than for
326
+ NERVE (1.05x) — a bigger model gives the builder more to optimize. Use it:
327
+
328
+ ```python
329
+ import onnxruntime as ort
330
+
331
+ sess = ort.InferenceSession(
332
+ "4x_HEART_fp16.onnx", # static shape, e.g. 1x3x256x256
333
+ providers=[
334
+ ("TensorrtExecutionProvider", {
335
+ "trt_fp16_enable": True,
336
+ "trt_builder_optimization_level": 5,
337
+ "trt_cuda_graph_enable": True,
338
+ "trt_engine_cache_enable": True,
339
+ "trt_engine_cache_path": "trt_cache",
340
+ "trt_timing_cache_enable": True,
341
+ }),
342
+ "CUDAExecutionProvider",
343
+ ],
344
+ )
345
+ ```
346
+
347
+ Caveats: this is a **single size (256px)** on one GPU, and ONNX/TensorRT need a
348
+ **static shape** — export one per size you use. HEART is **ONNX-only** (no ncnn;
349
+ its attention ops don't convert cleanly).