# cn-conversion-script The scripts that build the CuNNy and ArtCNN ncnn files in this repository: glsl_net.py parses a CuNNy DS shader of any size into convolution layers, ncnn_graph.py writes ncnn .param and .bin files, convert.py builds every form. SHA256SUMS lists the expected SHA-256 of all 30 files convert.py writes. - **Upstream:** Original work for the Emanata app - **Source:** This repository - **License:** Apache-2.0. Copyright (c) 2026 the Emanata authors. See NOTICE and LICENSE-Apache-2.0.txt. The files the scripts produce keep the licenses of the models they are converted from. - **License files:** LICENSE-Apache-2.0.txt, NOTICE - **Changes:** Not applicable (original work). | File | Bytes | SHA-256 | From | |---|---|---|---| | convert.py | 5188 | `c651b6c515666d1a2624bc4f19a533891b034d5c99659f22785df6a904d0eae6` | this repository (original) | | glsl_net.py | 8536 | `9498c96e49a0fa3653f136555b2521c6cbbfe883c4558a4e2e09e78192303329` | this repository (original) | | ncnn_graph.py | 5637 | `ee7e1e95533c1156a0d4d73b7101b6b1ab7a9ee63ee074c17bd097cd1f76f8f0` | this repository (original) | | SHA256SUMS | 2884 | `1e729be24e3a3173877366c439fa43b55d6ae27da0eb202dd4591b5e2c849608` | this repository (original) | ## Build Tested with Python 3.12, numpy 2.5.4 and onnx 1.23.2. The ncnn Python package is needed only by `ncnn_graph.load_and_run`, not for converting. ``` pip install numpy==2.5.4 onnx==1.23.2 python convert.py models \ ../cunny-8x32-ds-shader/CuNNy-8x32-DS.glsl ../artcnn-c4f32-ds-upstream/ArtCNN_C4F32_DS.onnx ../cunny-ds-shaders/CuNNy-faster-DS.glsl ../cunny-ds-shaders/CuNNy-fast-DS.glsl ../cunny-ds-shaders/CuNNy-4x12-DS.glsl ../cunny-ds-shaders/CuNNy-4x16-DS.glsl ../cunny-ds-shaders/CuNNy-4x24-DS.glsl ../cunny-ds-shaders/CuNNy-4x32-DS.glsl ../artcnn-c4f16-ds-upstream/ArtCNN_C4F16_DS.onnx sha256sum -c SHA256SUMS ``` convert.py writes 15 .param/.bin pairs into `models/`: every form of CuNNy-8x32-DS and ArtCNN C4F32 DS, and the app's form of every other size. This repository hosts all of them: cunny-8x32-ds-rp, cunny-8x32-ds-variants, artcnn-c4f32-ds, artcnn-c4f32-ds-variants, cunny-faster-ds-rp, cunny-fast-ds-rp, cunny-4x12-ds-rp, cunny-4x16-ds-rp, cunny-4x24-ds-rp, cunny-4x32-ds-rp and artcnn-c4f16-ds. ## Checks Every CuNNy size was run three ways on synthetic gray pages: the parsed weights in numpy (fp64) against libplacebo running the unmodified shader (about 52 dB luma for every size, 8x32 included: the PC pipeline's own rounding; the sizes differ from each other by 39-43 dB); the ncnn file on the CPU in fp32 against numpy (130-147 dB: exact); and on a Vulkan GPU in fp16 (65-69 dB). ArtCNN C4F16 DS against onnxruntime: 130 dB on the CPU, 61 dB on the GPU in fp16.