StableDiffusion 2.1 converted to fp16 ONNX model to run GPU accelerated NodeJS code
https://github.com/dakenf/stable-diffusion-nodejs
1import * as tf from "@tensorflow/tfjs-node"
2import { StableDiffusionPipeline } from 'stable-diffusion-nodejs'
3
4const pipe = await StableDiffusionPipeline.fromPretrained(
5 'directml', // can be 'cuda' on linux or 'cpu' on mac os
6 'aislamov/stable-diffusion-2-1-onnx', // relative path or huggingface repo with onnx model
7)
8
9const image = await pipe.run("A photo of a cat", undefined, 1, 9, 30)
10const png = await tf.node.encodePng(image[0])
11fs.writeFileSync("output.png", png);