solstice-80m-webgpu / js /models.js
thalismind
Claude Opus 5.5
feat: Solstice 80M and Nyx 36M in the browser with prompt sweeps, embedding arithmetic and runtime LoRAs
48441eb
Raw History Blame Contribute Delete
5.53 kB
// Model registry. Every model is one ONNX forward; prompt encoding and sampling happen in sampler.js.
//
// io: 'solstice' -> inputs x, t, pool, tokens, mask (+ w for students, + sc for the r80 teacher), output v
// 'nyx' -> inputs x, t, text_pool, text_tokens, text_mask, output v_pred
// guided: distilled students take the guidance scale as input `w` and run one forward per step
// selfCond: the r80-1202 teacher takes the previous x0 estimate as `sc`
// lora: LoRAs can be applied: the fp32 export gets LoRA inputs added in the browser (onnxlora.js)
const SOLSTICE = 'https://huggingface.co/ThalisAI/solstice-80m/resolve/main';
const NYX = 'https://huggingface.co/Bhoidy/nyx-image-36m/resolve/main';
export const VARIANTS = {
fp32: { label: 'fp32', note: 'WebGPU or WASM' },
int8_dynamic: { label: 'int8 (dynamic)', note: 'WASM only, smaller download, visible colour drift', wasmOnly: true },
};
export const MODELS = [
{
id: 'r80-teacher', family: 'solstice', group: 'Solstice 80M · r80-1202 (current)',
label: 'Teacher (30 Heun steps, CFG)', io: 'solstice', guided: false, selfCond: true,
url: (v) => `${SOLSTICE}/onnx/r80-1202/teacher/${v}.onnx`, variants: ['fp32', 'int8_dynamic'],
lora: true,
steps: 30, maxSteps: 60, sampler: 'heun', guidance: 4,
},
{
id: 'r80-s20', family: 'solstice', group: 'Solstice 80M · r80-1202 (current)',
label: '20-step student', io: 'solstice', guided: true, selfCond: false,
url: (v) => `${SOLSTICE}/onnx/r80-1202/student-20-step/${v}.onnx`, variants: ['fp32', 'int8_dynamic'],
lora: true,
steps: 20, maxSteps: 40, sampler: 'euler', guidance: 4,
},
{
id: 'r80-s10', family: 'solstice', group: 'Solstice 80M · r80-1202 (current)',
label: '10-step student', io: 'solstice', guided: true, selfCond: false,
url: (v) => `${SOLSTICE}/onnx/r80-1202/student-10-step/${v}.onnx`, variants: ['fp32', 'int8_dynamic'],
lora: true,
steps: 10, maxSteps: 20, sampler: 'euler', guidance: 4,
},
{
id: 'r80-s5', family: 'solstice', group: 'Solstice 80M · r80-1202 (current)',
label: '5-step student', io: 'solstice', guided: true, selfCond: false,
url: (v) => `${SOLSTICE}/onnx/r80-1202/student-5-step/${v}.onnx`, variants: ['fp32', 'int8_dynamic'],
lora: true,
steps: 5, maxSteps: 10, sampler: 'euler', guidance: 4,
},
{
id: 's80-teacher', family: 'solstice', group: 'Solstice 80M · s80-1201 (retired)',
label: 'Teacher (40 Euler steps, CFG)', io: 'solstice', guided: false, selfCond: false,
url: (v) => `${SOLSTICE}/onnx/s80-1201/teacher/${v}.onnx`, variants: ['fp32', 'int8_dynamic'],
lora: false, steps: 40, maxSteps: 60, sampler: 'euler', guidance: 4,
},
{
id: 's80-s10', family: 'solstice', group: 'Solstice 80M · s80-1201 (retired)',
label: '10-step student', io: 'solstice', guided: true, selfCond: false,
url: (v) => `${SOLSTICE}/onnx/s80-1201/student-10-step/${v}.onnx`, variants: ['fp32', 'int8_dynamic'],
lora: false, steps: 10, maxSteps: 20, sampler: 'euler', guidance: 4,
},
{
id: 's80-s5', family: 'solstice', group: 'Solstice 80M · s80-1201 (retired)',
label: '5-step student', io: 'solstice', guided: true, selfCond: false,
url: (v) => `${SOLSTICE}/onnx/s80-1201/student-5-step/${v}.onnx`, variants: ['fp32', 'int8_dynamic'],
lora: false, steps: 5, maxSteps: 10, sampler: 'euler', guidance: 4,
},
{
id: 'nyx-36m', family: 'nyx', group: 'Nyx Image 36M',
label: 'Nyx-2 (Heun, CFG)', io: 'nyx', guided: false, selfCond: false,
url: () => `${NYX}/nyx-image-36m.onnx`, variants: ['fp32'],
lora: false, steps: 24, maxSteps: 50, sampler: 'heun', guidance: 4,
},
];
// Optional live text encoder for Nyx (free-text prompts): the quantised SigLIP text tower from the Nyx space.
export const NYX_SIGLIP = {
url: 'https://huggingface.co/spaces/Bhoidy/nyx-image-36m/resolve/main/siglip_text_quantized.onnx',
tokenizer: 'Xenova/siglip-base-patch16-224',
};
// LoRA input groups of an r80 export, for describing uploaded LoRA files before a model is loaded.
// The feeds use the spec the rewrite itself reports.
const R80_HIDDEN = { outer_encoder: 1152, bottleneck: 1024, outer_decoder: 1152 };
const R80_BLOCKS = { outer_encoder: 4, bottleneck: 12, outer_decoder: 4 };
export const R80_LORA_SPEC = Object.keys(R80_BLOCKS).flatMap((stack) => {
const h = R80_HIDDEN[stack];
return [
['self_attn.qkv', 384, 1152], ['self_attn.proj', 384, 384], ['cross_attn.q', 384, 384],
['cross_attn.k', 384, 384], ['cross_attn.v', 384, 384], ['cross_attn.proj', 384, 384],
['mlp.w12', 384, 2 * h], ['mlp.w3', h, 384],
].map(([layer, inDim, outDim]) => {
const base = `lora_${stack}_${layer.replace('.', '_')}`;
return { stack, layer, blocks: R80_BLOCKS[stack], in: inDim, out: outDim, A: `${base}_A`, B: `${base}_B` };
});
});
// The six example LoRAs released with r80-1202
export const LORAS = [
{ id: 'ghost', label: 'Ghost texture', trigger: 'spectral style' },
{ id: 'monochrome', label: 'Monochrome', trigger: 'monochrome' },
{ id: 'cyberpunk', label: 'Cyberpunk', trigger: 'neon city style' },
{ id: 'knight', label: 'Knight identity', trigger: 'sir aldric' },
{ id: 'slime', label: 'Slime', trigger: 'slime style' },
{ id: 'princess', label: 'Princess', trigger: 'princess style' },
].map((l) => ({ ...l, url: `${SOLSTICE}/loras/r80-1202/${l.id}/lora.safetensors` }));
export function modelById(id) {
return MODELS.find((m) => m.id === id);
}