aislamov commited on
Commit
0799d81
·
1 Parent(s): 9f697c9

Create README.md

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