Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C
3.3 KB
Raw Blame
/* qwenimage_preview.h -- the latent -> RGB map of the live previews.
 *
 * One linear map from the 64 normalized latent channels of Qwen-Image-2.1 (plus
 * a bias, row 64) to the mean RGB of the latent pixel's 16x16 tile, in [0, 1].
 * Fitted by tools/qwenimage_fit_preview.py on the real VAE encoder over six
 * images (a photo of a cat, a test card, two foxes, a neon street at night, a
 * colour wheel). Held out one at a time, the RMS error per channel was 13 to 33
 * of 255 on ordinary pictures and 52 on the night scene: a preview, not the
 * image, which comes from the VAE at the end. */
#ifndef COLIBRI_QWENIMAGE_PREVIEW_H
#define COLIBRI_QWENIMAGE_PREVIEW_H
static const float QI_PREVIEW_RGB[65][3] = {
    {-0.000162f, 0.007304f, 0.016449f},
    {-0.023798f, 0.003098f, -0.015584f},
    {0.040925f, 0.015906f, -0.017933f},
    {0.030847f, 0.048854f, 0.011990f},
    {-0.004273f, 0.021853f, 0.002103f},
    {-0.002533f, 0.016935f, 0.013194f},
    {0.014251f, 0.011290f, -0.005530f},
    {-0.005634f, -0.046089f, -0.004886f},
    {0.008517f, -0.013905f, -0.010344f},
    {-0.047933f, 0.013475f, 0.032792f},
    {-0.018821f, -0.010070f, -0.007883f},
    {-0.007563f, 0.008810f, 0.010754f},
    {0.005722f, -0.029842f, -0.006200f},
    {-0.015920f, -0.027919f, -0.047562f},
    {0.015827f, 0.014994f, 0.009677f},
    {0.038689f, 0.024671f, 0.033631f},
    {0.026767f, 0.015371f, 0.020238f},
    {-0.007613f, -0.013988f, 0.004844f},
    {-0.003757f, 0.009013f, 0.000950f},
    {0.007186f, -0.013881f, -0.003376f},
    {0.009847f, 0.002135f, 0.015971f},
    {0.001250f, 0.011035f, 0.013640f},
    {0.013445f, 0.008677f, 0.028105f},
    {0.000957f, 0.009628f, 0.027064f},
    {-0.047716f, -0.017486f, 0.004429f},
    {-0.026926f, -0.022445f, 0.008302f},
    {-0.002730f, -0.000335f, -0.008732f},
    {-0.018194f, -0.014382f, -0.026248f},
    {0.008141f, -0.013082f, -0.002909f},
    {0.007258f, 0.018187f, 0.021778f},
    {-0.001354f, 0.003045f, 0.002348f},
    {0.005817f, -0.008618f, -0.006669f},
    {0.015531f, -0.004067f, -0.003251f},
    {-0.005029f, 0.006622f, -0.027742f},
    {0.008663f, 0.060584f, 0.062884f},
    {-0.004457f, -0.008098f, -0.026956f},
    {-0.014145f, 0.004375f, -0.005057f},
    {0.002530f, 0.001928f, -0.000307f},
    {-0.017628f, -0.012111f, 0.007016f},
    {-0.007397f, -0.040340f, 0.000047f},
    {-0.003694f, 0.005903f, -0.025010f},
    {0.082737f, 0.019231f, 0.029273f},
    {-0.011456f, -0.005718f, -0.006880f},
    {0.023613f, 0.017443f, 0.004153f},
    {-0.006679f, -0.020114f, -0.018899f},
    {0.027505f, -0.006793f, 0.005784f},
    {0.007613f, -0.013551f, -0.048627f},
    {-0.074491f, -0.018776f, -0.039472f},
    {0.001864f, -0.019908f, -0.000012f},
    {0.017660f, 0.059504f, 0.016122f},
    {-0.023709f, 0.004954f, -0.025340f},
    {0.006790f, -0.016079f, -0.012522f},
    {0.005409f, -0.017264f, 0.009443f},
    {0.030589f, -0.035789f, -0.055619f},
    {0.005542f, -0.008499f, -0.011957f},
    {-0.015744f, 0.015918f, -0.005303f},
    {-0.023556f, 0.000347f, -0.019940f},
    {-0.002043f, -0.017813f, -0.019266f},
    {0.006739f, -0.001820f, -0.005029f},
    {0.000393f, 0.002469f, 0.023242f},
    {0.016665f, -0.010279f, -0.012886f},
    {-0.008567f, -0.018800f, -0.023963f},
    {-0.004872f, -0.017309f, -0.007768f},
    {-0.017299f, 0.003615f, -0.025075f},
    {0.520193f, 0.476208f, 0.411574f},
};
#endif